The better way to do it is to direct your AI with variables in the main loop. In its simplest form, you have a series of IF statements that get processed every cycle...
Do
// Main logic of game
// .....
// Enemy awake?
if enemyAwake = 1
// run all the enemy logic here
endif
// Bomb exploding
if bombExploding = 1
// bomb logic here
endif
// hit by enemy
if attacked = 1
// lose health here
endif
sync()
Loop
Now you can control some of these flags with a timer. Here the enemy wakes up 10 seconds into the game...
time# = timer() + 10
Do
// Main logic of game
if timer() > time#
enemyAwake = 1
endif
// Enemy awake?
if enemyAwake = 1
// run all the enemy logic here
endif
// Bomb exploding
if bombExploding = 1
// bomb logic here
endif
// hit by enemy
if attacked = 1
// lose health here
endif
sync()
Loop
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt