## Any good Pong articles?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: Any good Pong articles?

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

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

### Re: Any good Pong articles?

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.

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: Any good Pong articles?

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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

### Who is online

Users browsing this forum: Bing [Bot] and 22 guests