您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122
  1. base = Class{}
  2. G = 6.67e-5
  3. function base:init(x, y)
  4. self.x = x
  5. self.y = y
  6. self.image = love.graphics.newImage("entities/base/base.png")
  7. self.w = self.image:getWidth()
  8. self.h = self.image:getHeight()
  9. end
  10. function base:update(dt)
  11. local distanceToShip = math.sqrt((firstShip.x - self.x)^2 + (firstShip.y - self.y)^2)
  12. if distanceToShip < self.w/2 then
  13. reachedGoal = true
  14. end
  15. end
  16. function base:draw()
  17. love.graphics.draw(self.image, self.x, self.y, 0, 1, 1, self.w/2, self.w/2)
  18. end