Collusion
djdee
Member Posts: 180
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
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
Best Answer
-
jamie_c ImagineLabs.rocks Posts: 5,772This tutorial might help with that, it's similar to what is mentioned above.
http://www.jamie-cross.net/?portfolio=gamesalad-recipe-003-enemy-collisions-detecting-a-head-jump-vs-a-side-collision
Answers
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
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮