Stomping on enemy problem. Please Help.

GallardoGallardo Member Posts: 10
edited November -1 in Working with GS (Mac)
I am creating a platformer with a Mario-Style-Jump. I cannot destroy the enemy by jumping on him. If I jump when the enemy passes in front of me only then is he destroyed. How can I destroy the enemy by only falling/jumping on him and not when I jump when he is in front of me?

Player Rules: constrain game.MainPlayer.Height to self.Size.Height
constrain game.MainPlayer.Position to self.Position.Y

Enemy Rules: Outer: Actor receives event, collides with Player
Inner: Attribute game.MainPlayerPosition greater-than-or-equal-to
self.Position.Y + self.Size.Height/2 + game.MainPlayerHeight/2

I will really appreciate any help. Thank

Comments

  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    Create a new boolean called jumpkill

    Create new rule
    If player.motion.linear.Y is less then -1
    Change attribute game.jumpkill to true
    Otherwise
    Change attribute game.jumpkill to false

    On your enemy
    Create new rule
    If actor collides with player
    If game.jumpkill is true

    Destroy
  • GallardoGallardo Member Posts: 10
    BrynjeBamsen you are the best. Thank you very much.
Sign In or Register to comment.