goal.lua 589 B

1234567891011121314151617
  1. Goal = class()
  2. Goal.size = 25
  3. function Goal:init()
  4. self.x = ctx.map.width - ctx.view.width / 2
  5. self.y = ctx.map.height - ctx.map.ground.height - self.size
  6. self.image = data.media.graphics.bread
  7. ctx.event:emit('view.register', {object = self})
  8. end
  9. function Goal:draw()
  10. local g = love.graphics
  11. g.setColor(255, 255, 255)
  12. local height = 100
  13. local scale = height / self.image:getHeight()
  14. g.draw(self.image, self.x + self.image:getWidth() * scale / 2, self.y - height / 2, math.sin(ls.tick / 10) / 10, scale, scale, self.image:getWidth() / 2, self.image:getHeight() / 2)
  15. end