How to Jump on an Enemy Or get Hit by the Side of an Enemy?
Slamuel
Member Posts: 10
Hello, Slamuel here again,
I need some help with my enemy actor. Basically, I have an enemy that moves left and right and I have my main actor that can be controlled. He can jump as well. Whenever I try to make a rule where if the player overlaps or collides with the enemy actor, he destroys that actor. But, I need a rule that can let my player jump on the enemy and destroy that enemy and when the player hits the left or right of that enemy he will get destroyed.
Any ideas on how to do that?
I need some help with my enemy actor. Basically, I have an enemy that moves left and right and I have my main actor that can be controlled. He can jump as well. Whenever I try to make a rule where if the player overlaps or collides with the enemy actor, he destroys that actor. But, I need a rule that can let my player jump on the enemy and destroy that enemy and when the player hits the left or right of that enemy he will get destroyed.
Any ideas on how to do that?
Comments
But basically, what you want to do using just two actor (the player and the enemy) is comparing the y value of the player and the enemy when they collide. If the Y value of the player is higher than the one of the enemy, than it means that the player is "above" the enemy, and so he can kill it. If the y is equal or lower than that of the enemy, it means it's at his side or under it, and so he gets killed instead. Obviously it depends on the height of the enemy and the height of the player too, but this is one of the way to do it so you can adjust it to your needs
Thanks Tshirtbooth I will email you shortly and thanks Hachiko I will look at the templates and try your method!