Collusion

Hi Guys,
Am working on an endless game. I have se collusion between my player and an object. The problem is that i want to bounce the player only when it collides on the top of the object, and if it collides its side it should stop. Any help would b appreciated.
Thank you

Answers

  • -Timo--Timo- Member Posts: 2,313
    make a integer attribute (lets say we call it playerY)
    and make a boolean attribute (lets say we call it bouncePlayer)

    go in the player and constrain game.playerY with self.position.Y-self.size.height/2

    go in the floor actor (or how you called it)
    and let it collide with the player.
    also make a rule with
    if game.playerY >= self.position+self.size.height/2(maybe also put -1 or -2 or something behind this code it this is not working) AND if overlaps or collide with player
    do
    change game.bouncePlayer to true

    go in the player and make a rule
    if bouncePlayer is true
    do
    change attribute self.motion.linear velocity.Y to 400 (or something)
    change attribute game.bouncePlayer to false

    hope this helped :)

Sign In or Register to comment.