Goomba-Like Enemies

EthanZarovEthanZarov Member Posts: 156
edited June 2012 in Working with GS (Mac)
Hey,
So, if you have ever played any Mario games, one of the main enemies are goombas. To kill them you must jump on top of them, but if you hit the sides, you get damaged. Is there a way to do his on GS easily? If so, please tell me.

Best Answer

  • domeniusdomenius Posts: 108
    edited June 2012 Accepted Answer
    if player.y>self.position.y+(self.size.height/2)+(player.size.height/2) -1
    ^Only the top row of pixels on an actor will trigger this rule. Players height can be a constant instead of a calculation if your players are always the same size. Wrap your goomba kill sequence in this rule and you should be good to go.

Answers

  • DanDaMan123DanDaMan123 Member Posts: 216
    I tried doing this in my most recent published game, so what you would do is you have a 'player' actor and an 'enemy' (goomba) actor. Also, what I would do is have an integer attribute called 'player y,' which you would use a constrain behavior to make it track the player's y value. Then, create a rule for the 'enemy' that if it collided with 'player,' then the player would die. (You could do this with an attribute or something.) But, you could have a rule that states if 'enemy' collides with 'player' and the attribute 'player y' > 'y value of enemy' (self.position.y) , then 'enemy' is destroyed. Try playing around with this, and good luck with the game.
Sign In or Register to comment.