What I want to do is to add a Mario style death animation
- Toss the player up and back a bit
- Let the player fall through the ground
What should I do?
What I want to do is to add a Mario style death animation
What should I do?
BasicallyâŚ
When the player is hit:
This should make the player jump then go through the platform while falling when he/she dies.
Thanks.
But if I disable the platform, wonât the enemies fall through as well?
Yep that is what happen. Maybe you use physics behavior and when you collide with enemy:
Deactivate platform behavior of the player and activate physics behavior and add small impulse to the angle of 270.
Thanks. I think I understand now.
In fact, you donât need the physics behavior to animate the player when he dies. Just use the built-in forces to do the animation. But before doing so, deactivate the platformer behavior on the playerâs sprite (you donât need to deactivate the platform behavior of the platform object).
Lol, yes. Every object that has the Platformer Sprite behavior will fall through.
Yeah, I figured out it was the platformObject property that prevented force from taking effect. I also tried the physics solution, because I might want to use bullet in the future as well.
Now I decide to let the player stay on the ground and go to the game over screen when the death animation is finished.
Thanks for your help everyone.
Wouldnât it be easier to create a new object? So this new âKOedâ Mario object spawns whenever Mario âdiesâ in the game (remove the real Mario or turn him invisible + disable controls) . Like an explosion appears when you defeat an enemy plane in a shootâem up game.
This new object doesnât have use platformer physics and moves upwards, then a timer activates a downwards movement. Sorry, not on my regular PC now, will try to post a screenshot of the code I have in mind later.
EDIT: This is very basic and of course needs more adjustments. Just to give a general idea of what I had in mind
So if you run into an enemy, the player turns invisible and a âKOedâ player sprite is created where the player was. This KOed sprite moves up, then slowly drops out of the scene. Important: The force that moves the KOed player up at 270° needs to have damping set to â0â, the force that pulls him down at 90° needs damping set to â1â.
This needs a bit more code here and there, like a code that restarts the scene and a code that prevents the invisible player from moving around.
So, why do you use another object instead of the player itself?
Maybe to stop the camera from following it?
That is a useful side effect I havenât been thinking about to be honest. I was thinking about the platform/physics engine problem. This new object doesnât follow the rules set by the platform engine and simply drops out of the screen, it will not interact with the floor, ceiling, walls etc. So it can be used while leaving the platform engine untouched.
Well today I just found I couldnât make the player leave the ladder without an input.
Simulate Pressing Ladder key for PlayerObject
Simulate Pressing Jump key for PlayerObject
Simulate Pressing Release key for PlayerObject
None of those above works.
I just want the player to drop from the ladder when a bullet hit(kill or not) him.
The only way that worked was changing the Platform property for the ladder.
Hello!
As a normal policy, please do not bump multi-year old threads. This would have been for GD4 since GD5 was only released in 2018. Most of the logic is the same, but youâd need to translate some of it to the newer event structure
You are welcome to make a new thread inquiring on how to do this, but I think I actually do something similar to what is being discussed here (Disabling the player controls, moving the player sprite as part of it, etc) in the knockback/player damaged logic in Not-a-vania, so you can look at that in the main example list if you would like. I think I also do something similar for the death animation, but I fade the character to grey instead of play another animation, the core logic should be the same.
Thanks!