TGC Codebase Backup



ai chaser by Slayer93

29th Apr 2005 21:37
Summary

a circle that chases you around until it hits you



Description

a circle that chases you around until it hits you.you are also a circle



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `````````````````````
``````ai chaser``````
`````````````````````

`sync
sync on
sync rate 30
hide mouse

`the varibles
x=100
y=100
x1=550
y1=400
s=4

`ai
ai:
do
cls
print x : print y : print x1 : print y1

`player
circle x,y,20

`enemy
circle x1,y1,20

`player controls
if c=0
if upkey()=1 then s=1
if downkey()=1 then s=2
if leftkey()=1 then s=3
if rightkey()=1 then s=4
endif
if s=1 then inc y,-15
if s=2 then inc y,15
if s=3 then inc x,-15
if s=4 then inc x,15

`enemy controls
if x > x1 then inc x1,15
if x < x1 then dec x1,15
if y > y1 then inc y1,15
if y < y1 then dec y1,15

`see if they are touching
if x=x1 and y=y1 then exit

sync
loop

`end
do
cls
text 100,100,"END"
if spacekey()=1 then goto ai
loop