Hello everyone, I have a noob question:
In Construct 2, when creating platformer games we always used another square/rectangle object as the player-mask. This mask would be invisible move around based on user-input and detect collisions, and behind the scenes a separate sprite [e.g., player-skin] would be pinned to the mask to give the appearance of the character [skin] moving. this was needed to ensure the collisions were accurate as the skin-sprite changed from frame-to-frame and the different sprite may not detect collision, but the rectangular mask would never change and always detect collisions correctly [and your character would not get “stuck” in a wall/platform].
My question is this: do you need to do the same thing in Gdevelop also, or does Gdev have a better collision detection under the hood so characters never get stuck in walls/platforms?
can you please share your experiences, and feedback? We’ve moved off of Construct and seek to develop exclusively on Gdev, but need some guidance on getting started.
thank you in advance for your help on this matter.
When you go to the object’s properties, you can edit its hitbox, which by default, is the full size of the first sprite of the first animation (invisible parts included).
This is fine for blocks, platforms, obstacles of all sorts, but for players and sometimes NPCs, it is often recommended to create a hitbox object and pin the sprites on it, as you’ll see in the old platformer example project.
That way, you can do whatever you like with the sprites, without interfering with the collisions and such.
Thanks a million for your detailed and quick reply. I will follow your advise, for the platformers/blocks/obstacles and I will also follow your advise for a separate hit-box used for the player, enemies/npc.
I’ll try to find and look at the old platformer example project.
Thanks a million, I appreciate your help.
I don’t think the old platformer example is available anymore, but I use that method for Not-a-vania, which is in the main example list.
I also could not find the old platformer example [maybe i didn’t search correctly or maybe it was removed over time, as you’d suggested], but thank you for pointing me in the right direction.
I did find the not-a-vania example, and it does have the “hero” sprit and the separate “herohitbox” sprite/mask. Just as it was suggested by you and @Gruk.
Thank you for telling me about the project example, i’ll use this as a template/reference for my game.
It’s still there, in my neck of the woods anyway.
But any project using that method will be a useful reference