enemy=object:extend() function enemy:new(x,y,sounds) self.x=x self.y=y self.dx=0 self.dy=-1 self.sounds=sounds; sounds.loop:setPosition(x,y,0) self.lastMoveTick=0 self.rate=game.currentTrack.info.beatDivisions end -- new function enemy:update(dt) if game.ticker.ticks-self.lastMoveTick>=self.rate then self:move() end -- rate end -- update function enemy:move() self.lastMoveTick=game.ticker.ticks self.x=self.x+self.dx self.y=self.y+self.dy self.sounds.loop:setPosition(self.x,self.y,0) end