Creating levels and end boss

There isn’t a “built-in” way to do multiple levels, it really depends on the game. A good place to start though is to break your program into functions. For example, have a function for creating the player, have a function for adding enemies to the game, etc.

Then, create a function that “cleans up” in between levels. That usually means deleting all of the sprites in the game, and there is a very useful block for doing that in the “Arrays” category that gives you a list of all of the sprites of a certain kind. For example, if I wanted to delete all of the enemies I might do this:

Once you have that, you can call your create functions to start a level and your cleanup functions to end it. You could have one function per level, or do what the platformer does and have a function that takes an image and places enemies on the map where certain colors are.

I hope that helps!

2 Likes