Hi. I can’t give you an exact answer, but I can point you in the right direction:
I have coded seeking enemies in at least two games made for the Corona Geek hangouts. You can get the full code to these games here:
Also here are links to some of the ‘enemy code including seeking logic’:
There are a few heavy duty topics involved, so if this is way too much, you can start with a simple timer that runs once every 100 ms or so. Simply have the transition to the player, then cancel that transition on the next run of the timer. This won’t be super pretty, but it’s a start on understanding the concepts.
local player = display.newCircle( 100, 100, 10 ) player:setFillColor(0,1,0) function player.randomMove( self ) if( self.removeSelf == nil ) then transition.cancel(self) return end tranistion.to( self, { x = math.random(50, 200), y = math.random(50, 200), onComplete = self.randomMove } ) end local enemy = display.newCircle (0,0,10) enemy:setFillColor(1,0,0) function enemy.seek( self ) transition.cancel(self) if( self.removeSelf == nil ) then return end transition.to( self, { x = player.x, y = player.y } ) timer.performWithDelay( 100, self.seek ) end player:randomMove() enemy:seek()