How can I add swimming to my game 2d top down game?
That is a very vague question. It’s going to depend on how your game is structured. In general, though, you will need to create swimming animations for your character, and detect when to enable/disable them.
2 Likes
- Add animations.
- Add a state machine that triggers when the character enters water.
- Add a physics layer to the tilemaps so that you can detect which ones are water.
2 Likes
since it’s top down, there is no difference with just walking.
just make animations for swimming, when the player enters the water play those animations instead of walking animations and change the speed to maybe something slower.
of course it is a good idea to use a state machine for these things, at least go in and out of swimming state.
when the player enters a swim area, change state to swimming, when the player exists, change back to walking.
so a swimming area would need an Area2D (in its layer) that the player can collide with.
2 Likes