Commit 2a6a020e by anshve

Upload New File

parent ca90d6a7
Showing with 39 additions and 0 deletions
Paddle = Class{}
function Paddle:init(x, y, width, height)
self.x = x
self.y = y
self.width = width
self.height = height
self.dy = 0
self.color = {1, 1, 1, 1}
self.score = 0
end
function Paddle:update(dt)
if self.dy < 0 then
self.y = math.max(0, self.y + self.dy * dt)
elseif self.dy > 0 then
self.y = math.min(VIRTUAL_HEIGHT - PADDLE_HEIGHT, self.y + self.dy * dt)
end
end
function Paddle:render()
love.graphics.setColor(self.color)
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height)
end
function Paddle:changeColor(color)
self.color = color
end
function Paddle:getScore()
return self.score
end
function Paddle:changeScore(newScore)
self.score = newScore
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment