Using tables to create levels

Hi,

So my game engine is over going a complete change. The game is Mighty Mower on the App Store and it’s currently played in portrait mode and uses 7 obstacles that are chosen at random in an infinite game.

I’ve already re coded most if the game so it will play in landscape mode instead on the next update. This was a good shout by the players who have been playing it.

As part of that I’m moving from infinite play to a levels/progress approach.

As I have the seven obstacles as classes I’m thinking of using a table to create levels that pull in sets of certain obstacles at key times.

I currently call a single instance of each obstacle and when the random picker has assigned an obstacle that obstacle moves across the screen and when it reaches a certain point moves back to the off screen start position and triggers the randomiser to pick another obstacle.

I’m looking to use the table to create an order for the obstacles and place them on screen at the right time using an instance. Then, when the obstacle has passed, I’m looking to remove itself (xxxxxxxx=nul).

Does that sound like I’m going in the right direction?

Thanks,
The Major

Sounds fine to me

Ace! thanks @Ignatz

just make sure you dont create too many instances in advance, depending on how much memory one instance is using, it might create problems.

Thanks @Jmv38 that’s a good call.

What I’m thinking of using is a single instance of each obstacle (the way I do currently) but instead of using my random math function to choose which one is next, I’ll use a table list to see which triggers next.

You see each object has its own specific hit detection within itself and stays in position off screen until called.

I could use the table to add an object to the stage but then I’m not sure how to get it to remove itself.

I want to get the object to remove itself once it moves off screen.

Thanks
The Major