Advertisement
joseleeph

Untitled

Dec 23rd, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. Paddle = Class{}
  2.  
  3. function Paddle:init(x, y, width, height)
  4. self.x = x
  5. self.y = y
  6. self.width = width
  7. self.height = height
  8.  
  9. self.dy = 0
  10. end
  11.  
  12. function Paddle:update(dt)
  13. if self.dy < 0 then
  14. self.y = math.max(0, self.y + -self.dy * dt)
  15. elseif self.dy > 0 then
  16. self.y = math.min(VIRTUAL_HEIGHT - 20, self.y + self.dy * dt)
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement