Cycle through levels

Hey all!

Just a quick question if anyone can help!

I’m currently working on a ‘level select’ feature for my game, and I’m hoping to be able to cycle through each ‘stage’ with clickable arrows, and then you select your ‘stage’ then you see all available levels!

(I’ll attach a small illustration to show what I mean)

I have the basic funtionality down of the selecting a stage, and then selecting a level, but I have no idea how to tackle the carousel aspect! Any pointers or ideas are much appreciated! ^^

Thanks for reading!

1 Like

Heya!

Could you define a little more clearly what you mean by “carousel aspect” please?

Of course!

I just mean that it would only show one Stage at a time, and when you press the arrows, it would cycle through them!

So it starts on Stage one -player clicks arrow- changes to Stage 2 -player clicks arrow- changes to next, and eventually comes back to the start!

I think carousel means that it cycles through automatically, so I might have used the wrong word :sweat_smile: But I hope this clears it up!

It’s pretty simple, but I’m much moreso a designer than a developer, so my skills are very rusty! ^^

Thanks so much for responding!

Well I will write the steps of achieving it in a simple manner. There would be deeper design steps to it but I will ignore those for now and deliver the fundamentals.

  1. Know your Stages count available.
  2. Upon button clicked get next/prev stage and build it.
  3. Set Stages data and necessary elements.
  4. Set child to container and render.

Ofcourse you can make animations after clicked or other improvements however this is basically easiests and hardcoded way of making a carousel but still extendable.

The proper way of doing it would be getting data from a new table struct. Getting the id of row and its elements and making it flexible for future usage with dynamic inserts, states and many more levels of design.

However I beleive this would help you to get things kick started.

Make a container like below as widget.

Add this or similar counting script to it.

Make the stage (inner) widget and its elements to it.

You can simply hardcode data like this with a switch

You can find the screenshot scripts over here as well.

2024-05-07 17-59-16.mkv (2.1 MB)

If you want to make it somewhat better for future, I suggest you to take a look at data tables and structs