Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

hey thanks! i used a tilemap as the "source of truth" for all the blocks and for all input, i updated the tilemap. for example, if the player presses left, you check the tilemap to see if the player tile can move left or not.

the game was completely playable with placeholders until very close to the end and looked something like this:

what you see in the final product is just a "dumb" UI layer on top of the placeholders and i use tweening to move the tile positions from the current one to the next one.

(1 edit)

thanks alot
almost no one has made a guide to making a sokoban game in godot without it using real collisions instead of checking so this is very nice

also how did you tackle undo and reset?

you need to be able to encapsulate any given board state in some kind of data structure, like a 2d array. then, whenever the player moves, update the board state and maintain an array of the past board states. if the player presses undo, simply revert back to the last state. similarly for reset, go back to the first board state.

so do i need to make the array by hand or make some system that automatically makes the array?

for example, you can have an array of objects where each object looks like { coordinates: (0, 4), tile_id: 2 }. whenever a change happens on the board, you can create a new entry (a new array) and capture all the active objects on the board. if you ever undo, you need to grab the previous array of active objects and be able to interpret it and update the board.

Show post...

Thanks a lot! This is really helpful and I havent really seen anyone else give such a good tutorial on this with actual collision