1coinblockanimation = class:new() 2 3function coinblockanimation:init(x, y) 4 self.x = x 5 self.y = y 6 7 self.timer = 0 8 self.frame = 1 9end 10 11function coinblockanimation:update(dt) 12 self.timer = self.timer + dt 13 while self.timer > coinblockdelay do 14 self.frame = self.frame + 1 15 self.timer = self.timer - coinblockdelay 16 end 17 18 if self.frame >= 31 then 19 addpoints(-200, self.x, self.y) 20 return true 21 end 22 23 return false 24end