is there a way to use the 2nd (smaller) box to break my object like in Super Mario Bros series
like I know the base to do it, something like this but instead of just “collision with object” it would need to be “collision with object’s specific collision mask”
No, but you can add another (hidden) sprite at this position and check collision.
Alternatively you can have 2 animations for the block, both the same image. Have full collision mask for the first animation, and a smaller collision mask for the second. Make sure that the sharing collision masks for all animations is set to false/off :
- Add a trigger once to the event in your original post.
- Add 2 sub-events to that event
. First sub-event checks if animation number is 1, in which case delete the BreakableNormal.
. Second sub-event checks if animation number is 0,and change the animation number to 1 if so.
(the order of the above two sub-events is crucial - swap them around and the block disappears as soon as you hit it)
Someone was asking about something similar on the discord.
It’s probably easier to just check that a custom point on the top of player sprite is inside the block. Here’s how I did it as a test:
(the point named “point” is a custom point on the player object).
The platformer behavior is disabled to ensure the player jumps “through” where the block used to be, instead of bouncing off.
Note: you do want to have the point ~6-10 pixels above the player’s head (it can go outside of the sprite box if needed), to ensure that there’s enough time for the event to fire off in a frame.
https://game-previews.gdevelop-app.com/1654824598265-362111/index.html here’s a test with the platformer example.