Page 2 of 2
Re: Any good Pong articles?
Posted: Sat Jan 17, 2015 7:37 pm
by s-ol
Jeeper wrote:nice wrote:
Could you explain further what it does? personally I don't really know what's happening
The variable vy (Vertical Velocity in this case) determines the vertical direction
and speedof the ball. When the ball collides with the paddle it checks where on the paddle it has collided; the higher up the collision was the lower it sets the velocity, the lower the collision was the higher it sets the velocity.
FTFY
Re: Any good Pong articles?
Posted: Tue Jan 27, 2015 10:13 pm
by Rukiri
Instead of making multi hitboxes just conver rad to deg and using arctan2.
Code: Select all
degree = radtodeg(arctan2(vec1.y - vec2.y, vec2.x - vec1.x));
(not lua) but lua should have radtodeg and arctan2 functions.
Re: Any good Pong articles?
Posted: Wed Jan 28, 2015 4:58 pm
by s-ol
Rukiri wrote:Instead of making multi hitboxes just conver rad to deg and using arctan2.
Code: Select all
degree = math.deg(math.atan2(vec1.y - vec2.y, vec2.x - vec1.x))
(not lua) but lua should have radtodeg and arctan2 functions.