Maze game and Levels?

Back asking about levels!

Students have followed the Maze tutorials and we are now looking at expanding these to create different levels. They are running into problems…they are using if statements in a forever loop to say, if level = 1 then load this tile map - if else level = 2 then load this tile map else game over win.

But it’s not working properly and they also have a timer that they want to reset in between level changes.

Any ideas how to add levels, a simple and basic way students who are 10 can understand (AND ME!) also reset the timer each time?

Thanks!

2 Likes

try on game update instead of forever

The algorithm behind is each time the player reaches level destination, do the following:
a) clear current level, say, destroying sprites only suitable in this level
b) initial new level, load new tilemap, create player sprite or place it to start point, create new enemies / traps
c) start a new timer.

With some conventions, like same tile for start point / endpoint / enemies spawning spots / traps, we could extract the difference of level into different tilemaps and put them into a list (array).

Demo project is here.

4 Likes

A very simple demonstration but it is well written, and your explanation is great. Nice work.

1 Like