Side Collisions
CreativeJuicesEntertainment
Member Posts: 85
I need to be able to detect when my hero is colliding with the side of an image to disable jump (just change grounded to false), and I need to be able to also disable jump (grounded changed to false) when my hero is colliding with the top of one actor and the side of another at the same time. I tried it but it's trial and error. The side and top collision cancelling jump is working; I just want to make sure I'm doing it right. Also, colliding with the side and disabling jump is not working. This may have to do with that when I collide I enable jump. I put actors into different tags to see if it was because it was the same collision (one rule said to enable jump when colliding with actor, other said not to when colliding with side) but that did not work. Thanks in advance and any further information needed to better troubleshoot the problem will be given if needed.
Comments
If that is your question, what you need to do is constrain smaller actors to the main actor. and then assign collision actions to those smaller actors which will effect the main actor.
Or you could just constrain the position of the enemey and have rules,
If enemy x position is more/less then self. Position x
Do whatever
Same goes for y.
But if there is more then one enemey it might be few extra lines if code involved.
http://www.jamie-cross.net/?p=607
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page