+ 7
Javascript Collision
So i am making an infinite jumper game and i was wondering how i should make a collisiob system. Made in js without collision btw. I have a few ideas but i want to know what you think :) https://code.sololearn.com/WlO7yaq53vov/?ref=app
4 ответов
+ 5
Check if the x of the player is greater than the x of the obstacle.
+ 5
Thanks guys i'll be sure to try them out :D
+ 4
Quick detail about the code: its gonna be like a template so you can easily change the characters
+ 3
so, you must check on destination between two objects and it will be: destination = radius1 + radius2
then, if(positionObject1.x - positionObject2.x <= destination)
vectorObject1.x = - vectorObject1.x
vectorObject2.x = - vectorObject2.x