If anybody has some suggestions for saving tokens on this game's code I'd be very thankful! So far this is what I have and I'm going to add more levels and some more mechanics for the game but I don't want the token count to keep getting longer from the level set up.
You have plenty of room in the map to store your levels. use the top left 16x16 as your screen area, and the rest for your levels.
"Loading" a level is just copying the data into the work area. No need to use code that places elements depending on the level number, just scan the working area after loading and create your objects accordingly.
By spacing them regularly in the map, you can even know where they are without needing to save the level coordinates in the code.
For example, put a player sprite in your level map, and when you scan the tiles after loading, set p.y and p.y to x and y when you encounter the sprite, same logic for your doors and keys.
About the game : nice puzzle.
Visually, it would be nice to distinguish between gates and "anti gates".
You could also use cartdata/dset dget to save progress.
This is great. Nice work.
The diagonal movement bug has to be fixed otherwise I can cheat my way through the whole game in a few seconds. (up+right together for example.)
I re-inputted the 15 levels as map data and edited the _init() to get the level data from the map instead of having the levels entered as code.
If you add more level, remember to modify the function find_level(l) that takes a level number as parameter and retuns the x,y location in map tiles where the 6x6 level is located.
feel free to ask if anything is unclear about my code.
Oh, there's also some leftover debug code that displays the currently selected level in the menu, feel free to remove or adapt the menu layout if you want to keep it.
[Please log in to post a comment]