Board Thread:Questions and Answers/@comment-24386245-20140810124312/@comment-5106053-20140810145244

For random events: IF!RND(10)THEN ... That will have a 1 in 10 chance in being executed, change the number to whatever chance you want, also I would recommend having all the AI in it's own subroutine Ex: @AI

Now if you don't want AI being updated every 1/60 of a second, then you can do something like this: IF!(MAINCNTL%3)THEN GOSUB@AI That will update the AI every 3rd frame(every 1/20 of a second), this is essentially the reaction time of enemies, again you can change the number to whatever you want.

Ok so for player tracking: EX=EX+SPD*COS(ATAN(PY-EY,PX-EX)) EY=EY+SPD*SIN(ATAN(PY-EY,PX-EX)) Where PX and PY are the players coordinates, EX and EY are the enemy's coordinates, and SPD is the speed to move at, this will cause the enemy to move in a straight line towards the player, you may also need to implement path finding to move around obstacles, but this would work for something like a homing missile.