java script problem: I want to make player collision for my game pong

Started by
1 comment, last by Irusan, son of Arusan 5 years, 5 months ago

Im a beginner programmer in java script (hobbyist) and im trying to replicate pong in the p5.js web editor. i have this problem that i cant solve with the player colision, i tried several things. i ahve the distance from the player to the ball but i dont know how to use that information to make a colision detection.

i provide you the code below:

https://editor.p5js.org/p3nd_/sketches/rkAEBmgeV

would be very happy if i would get help.

Advertisement

Distance from the centre of your player to the centre of the ball won't help you. You need to look at the relationship between the ball and the line that defines the edge of your player's bat. Here are a couple of tutorials that may help you.

This topic is closed to new replies.

Advertisement