Tile Collisons, Ladders, and metroidvania-style falls

Hi everyone,

Just getting into Defold, did some of the tutorials, now I am branching out! I’m still learning many of the ins and outs of the engine, as well as lua, but I figure the best way to learn is to set some goals and ask other what they have done!

*I am working on a metroidvania game. Call it a castlevania clone, mechanically.

  1. I have a small issue with my tilemap. It appears that the collisions off are by a single block on the y-axis. I “solved” the issue by offsetting my player’s collision box, but that is going to cause issues later on. The tile collision mapping seems to be working fine though. What are some likely spots to look to solve this?

  2. Speaking of collisions. There are two cases for which I’d like to hardwire the game to essentially ignore any environmental collisions (or possibly, a specific tilemap layer). The first is when climbing a ladder. The initial idea that popped into my head was to basically include the ladder on the tilemap visually. Then create an empty game object that has a collider. When the player collides with it, they can move up and down, possibly after/while pressing an action button.

I am not sure how to grab that collision information though… or how to code that at all lol, lua is not my strong suit. Also, this may or may not be modular? I foresee the “drawback” where I will have to make a gameobject for each ladder individually–that isnt too bad honestly, but if there is a better Id certainly like to know.

  1. the easier case of the two is “platform falling”. Castlevania’s solution to descending quickly is to let you fall through platforms when you hold down the crouch or down movement key/button. What would be the easiest way to accomplish this?

screenshot of the development level!


Let me know what additional info I can provide to give a better picture of the game! Thank you sincerely in advance for your time <3

1 Like

here is a better screenshot with physics debugging enabled.

Have you enabled Physics debugging to see the actual collision shapes? Debugging in Defold

A tilesource (used by a tilemap) can have many different collision groups (Defold tile source manual). If you assign the ladder tiles to a “Ladder” collision group you can treat that differently in your collision handling logic. Are you creating the platformer game logic from scratch or are you basing it on an existing sample project?

I’d temporarily disable the collision object on the player and then enable it moments later when you know the player has fallen completely through the platform. You can use timer.delay() for this! Or set a flag in your player script to track this state and reset it as soon as you are no longer detecting a collision with the platform (when you have fallen through completely).

1 Like

Hi thanks so much for your response!

  1. Yes! I figured it out slightly after I posted, the debugging mode confirms my suspicions, but I’m still not sure what is causing the tile map collision boxes to be off by 1 tile? Maybe ill just go over everything again.

  2. Interesting. I am working from the “Game Developers” tutorial videos! I am not sure how similar that is to the platformer example files.

  3. Thank you again! That seems simply enough to implement, and extremely helpful!

1 Like

I love the look of this game. Good luck with it.

1 Like

Thank you <3