Bounce after smashing the enemy

GallardoGallardo Member Posts: 10
edited November -1 in Working with GS (Mac)
What rule can I create which will make the player bounce up when he smashes an enemy? I want to give room to change the enemy sprite to that of a smashed one. Here is an example of what I want to do.

http://imageshack.us/photo/my-images/696/supermariojump.png/

Any help would be greatly appreciated.

Comments

  • bluebyu25bluebyu25 Member Posts: 500
    Just interpolate his self.position x to whatever you need for however high you want him to go. Just make it dependent on the rule firing when he jumps on your enemy (overlaps/collides with) or you could acclerate or change velocity, whichever.
  • GallardoGallardo Member Posts: 10
    Thanks for the quick response bluebyu25. Do you mean interpolate self.position y? I do not have a (overlaps/collides with) rule in my player which kills the enemy. I have:

    Global boolean called jumpkill

    Player"
    If player.motion.linear.Y is less then -1
    Change attribute game.jumpkill to true
    Otherwise
    Change attribute game.jumpkill to false

    Enemy:
    If actor collides with player
    If game.jumpkill is true
    Destroy

    Thanks to BrynjeBamsen, this allows my player to kill the enemy only when I hit the enemy from the head.
    But now how do I make player bounce up when I kill enemy?
  • scribblstudiosscribblstudios Member Posts: 118
    Use, when collides with enemy, change attribute self motion linear velocity y to 150 (the jump speed).
    However make sure your actor also has some sort of gravity, otherwise you'll just keep moving up.

    Hope this helps! :)
  • bluebyu25bluebyu25 Member Posts: 500
    Yes I did mean Y whuups!
  • GallardoGallardo Member Posts: 10
    Thank you for your contributions bluebyu25 and scibblestudios, I appreciate your help.

    The reason that I am avoiding "collides with enemy" is that I want to destroy the enemy only when I hit his head and not when I run into him. Running into the enemy is also considered a collision. Establishing this specific preference, I am trying to create a rule which creates the bounce only after I have fallen on top of the enemy.

    To satisfy my preference for how to destroy the enemy I would like to maintain the stated rules I have for the player and the enemy. How can I add the bounce to the player which is caused by destroying the enemy while maintaining these stated rules?

    This is a tough one.
Sign In or Register to comment.