Any good Pong articles?

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

Re: Any good Pong articles?

Post by s-ol »

Jeeper wrote:
nice wrote:
Could you explain further what it does? personally I don't really know what's happening :P
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
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Re: Any good Pong articles?

Post 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.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Any good Pong articles?

Post 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.

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
Post Reply

Who is online

Users browsing this forum: No registered users and 243 guests