Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Ball.lua #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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