Advertisement
joseleeph

Untitled

Apr 27th, 2021
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Bullet = Object:extend()
  2.  
  3. function Bullet:new()
  4. self.image = love.graphics.newImage("bullet.png")
  5. self.x = x
  6. self.y = y
  7. self.speed = 700
  8. -- used for collision checking
  9. self.width = self.image:getWidth()
  10. self.height = self.image:getHeight()
  11. end
  12.  
  13. function Bullet:update(dt)
  14. self.y = self.y + self.speed*dt -- bullets will move vertically
  15. end
  16.  
  17. function Bullet:draw()
  18. love.graphics.draw(self.image, self.x, self.y)
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement