The logic I use looks like this
global movementtimer = timer()
global rateofmovement = 100 ` milliseconds
currenttimer = timer() ` snapshot of current timer value
if currenttimer >= movementtimer + rateofmovement then Itstimetomove()
function Itstimetomove()
` Your enemy move logic
movementtimer = timer() ` Update timer for next movement
endfunction
The rateofmovement global variable specifies how many milliseconds to wait until the enemy moves again. The lower the value, the faster it moves. The movementtimer variable records the last time the enemy moved. The currenttimer is constantly compared against these during runtime.
CSL