Simple Random Box Game

I wanted to make a simple random box game.
9 boxes randomly appear and when the player hits a button it stops on one of the boxes.

Well, I have it working but wanted to know how others might approach a game like this.
Just looking for any suggestion or ideas about how this could have been done differently or better.

It was all done in a Blueprint with 9 child boxes.


2022-06-30 15-25-31

Here is the whole BP
Player input controls on the top.
On BeginPlay it collects all children to a var and sets all their visibilities to false.
Then it starts randomly turning on cube’s visibility to TRUE for 0.2 sec then back to FALSE.
Since I didn’t want the same cube being selected mor than once in a row there is a check against the Next Cube and the Current Cube. If they are NOT the same, then continue with the loop, otherwise randomly select another cube and test again.

Close ups

Thanks All

1 Like

Just a different take.

ToggleBoxes

4 Likes

I think this is a brilliant idea - take a common issue or game mechanic and find as many solutions as there are people. Wish it could be officially embraced & endorsed by Epic @Get_DOVAH_it.

A once-per-week “Show me how you would solve this blueprint puzzle thing!

It would obviously take some (wo)man-hours to sort, review, catalogue and publish it. Not sure about the format - repository snippets perhaps? All in one place, ideally.

We could finally redirect folks to one location when they ask about cycling cameras, finding widget references, updating progress bars…


Well, I have it working but wanted to know how others might approach a game like this.
Just looking for any suggestion or ideas about how this could have been done differently or better.

Since we can think outside the, ehm, box - here’s my take:

  • 1 component only, no loops
  • we generate coords and move that one component there
  • the non-repetition is handled by Shuffle (so there is a small 1/9 chance of repetition, which I graciously allowed here :wink: )
  • I bent the rules and you must hit the box to stop it

  • a version with interpolation:

3 Likes