Make the character explode when they don't fit inside a tight space made with tiles and the platform behaviour

Heyyyo guys

I have this simple character for a small demo game that I’m working on from time to time. They have the platform character behaviour and the tiles around them have the platformer behaviour.

image

Their size is 12x12 and they only have 3 basic animations.

Idle (You have this when you move etc)
Attack
Small (This one turns the character into a smaller version 8x8)

Now, there is a point in the game where you get to become small (From 12px to 8px) in order to fit into certain areas. When you are small you are not allowed to attack as it will turn you into your normal Idle size.

This is working fine and all, but my problem occurs when you attack while you are inside a tight area, like in the below example.

image

I want the game to PUNISH you for doing so, so if you attack while you are in an area like this I want the character to die.

In order to do so I gave to my character the below points.

TopWallCheck and BottomWall check. Basically the points appear only when you are in the Idle or Attack animation and if all of them are in contact with the Platform Tiles your character dies.

My events for this

For some reason this doesn’t work as I planned to.

When you grow in size during the small area the game changes you to the idle or attack animation but the Player isn’t getting deleted. Instead they are getting pushed downwards.

image

Sometimes they can get deleted if you move or wait a bit. While in the out of bounds position, If you attack again and wait the player gets deleted but this ruins the experience as I want it to happen the moment you attack.

image

I understand that this is probably because of the Platformer and Platformer character behaviours interfering, most likely getting confused by the change of the size and the system doesn’t know where to position the Player. Is there a way to make this work? Should I do something different completely?

It bothers me cause the character does get deleted but only after Gdevelop pushes them out of bounds so its not like my method isn’t working. Are Platformer Objects transferred into a different dimension or something?

It seems like the origin points might need to be adjusted. I’m pretty sure that when you change to a frame with different hitbox/points, the new origin point will line up with the old origin. I do see that you moved the origin to the center, is that true for the other animations as well?

1 Like

The condition that checks for player input to punch, add a subevent and check if the player is crouching. If the player is crouching, simply explode them if they are not, attack

1 Like

Sorry took me a while to mess with this again.

Yeah the origin is different because of the size difference of the small and normal sprite. I tried to make it the same for all animations but the issue still persists.

Hi what do you mean by crouching? Is there an event for such thing?

No, I mean that when the player wants to punch, you should first check if the player is crouching. This can be done by setting a boolean variable to true whenever the player is in a crouched state. If this variable is true and the player attempts to punch, then explode the player.