Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pong-5/Ball.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function Ball:init(x, y, width, height)

-- these variables are for keeping track of our velocity on both the
-- X and Y axis, since the ball can move in two dimensions
self.dy = math.random(2) == 1 and -100 or 100
self.dx = math.random(-50, 50)
self.dx = math.random(2) == 1 and -100 or 100
self.dy = math.random(-50, 50)
end

--[[
Expand All @@ -33,8 +33,8 @@ end
function Ball:reset()
self.x = VIRTUAL_WIDTH / 2 - 2
self.y = VIRTUAL_HEIGHT / 2 - 2
self.dy = math.random(2) == 1 and -100 or 100
self.dx = math.random(-50, 50)
self.dx = math.random(2) == 1 and -100 or 100
self.dy = math.random(-50, 50)
end

--[[
Expand All @@ -47,4 +47,4 @@ end

function Ball:render()
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height)
end
end