MartinK12
Member
I have basic working state machine for player in platformer game and it’s working fine.
Currently I have player states: on_ground, in_air, idle.
I want to add hit – for starter it will be basic collision event but later I want to create my own collision code in end step.
Whenever player gets hit by enemy I want to implement those things:
-knockback – player will be moved to the opposite side and above just few pixels,
-immunity - for 3 seconds player won’t be able to get hit again,
-lower health,
-player must be able to move all the time.
Should I:
-create hit state
-just implement those above things into states I already have
-just put all those things into step?
Where to put those things? I just can't get the grasp of hit
What solution is the most commonly used for hit?
Thank You
Currently I have player states: on_ground, in_air, idle.
I want to add hit – for starter it will be basic collision event but later I want to create my own collision code in end step.
Whenever player gets hit by enemy I want to implement those things:
-knockback – player will be moved to the opposite side and above just few pixels,
-immunity - for 3 seconds player won’t be able to get hit again,
-lower health,
-player must be able to move all the time.
Should I:
-create hit state
-just implement those above things into states I already have
-just put all those things into step?
Where to put those things? I just can't get the grasp of hit
What solution is the most commonly used for hit?
Thank You