hm having some trouble with a.i., at first i was just making an ivisible sphere around the enemy then when i touch that he comes closer, but ive got a feeling that thats cuasing some problems. im now trying to use the intersect command, but i have no idea how.
sync on
make matrix 1,500,500,25,25
rem u
make object cube 1,5
rem spehre
make object sphere 3,20
hide object 3
rem enemy
make object cube 2,5
rem enemy flamethrower
make object cylinder 5,1
make mesh from object 1,5
delete object 5
add limb 2,1,1
add limb 2,2,1
add limb 2,3,1
add limb 2,4,1
offset limb 2,1,0,5,0
offset limb 2,2,0,5,1
offset limb 2,3,0,5,2
offset limb 2,4,0,5,-1
rotate limb 2,1,90,0,0
rotate limb 2,2,90,0,0
rotate limb 2,3,90,0,0
rotate limb 2,4,90,0,0
color limb 2,1,0
rem sphree
make object sphere 4,20
hide object 4
position object 2,50,0,50
load image \"grey.jpg\",1
load image \"red.jpg\",2
load image \"orange.jpg\",3
for x=1 to 25
set matrix height 1,x,25,100
set matrix height 1,25,x,100
set matrix height 1,1,x,100
set matrix height 1,x,1,100
next x
update matrix 1
rem prepare matrix texture 1,1,1,2
rem set matrix texture 1,0,1
set matrix wireframe on 1
rem prepare matrix texture 1,2,2,1
rem set matrix texture 1,0,1
rem making the fire
make fire particles 1,2,5000,30,0,30,2,20,2
make fire particles 2,3,3000,30,-2,25,1,10,1
rotate particles 1,90,0,0
rotate particles 2,90,0,0
set particle gravity 1,100
set particle gravity 2,100
set particle life 1,20
set particle life 2,20
set particle chaos 1,20
set particle chaos 2,20
set particle velocity 1,1000
set particle velocity 2,1000
do
if upkey()=1
move object 1,0.5
endif
if downkey()=1
move object 1,-0.5
endif
if leftkey()=1
turn object left 1,0.5
endif
if rightkey()=1
turn object right 1,0.5
endif
rotate camera 0,0,0,0
position camera object position x(1),object position y(1)+5,object position z(1)-5
rotate camera object angle x(1),object angle y(1),object angle z(1)
move camera 0,-20
position object 3,object position x(1),object position y(1),object position z(1)
position object 4,object position x(2),object position y(1),object position z(1)
rem enemy flamethrower
rem ai
remstart
if object collision(3,4)=1
point object 2,object position x(1),object position y(1),object position z(1)
move object 2,0.05
endif
remend
distance#=intersect object (1,object position x(1),object position y(1),object position z(1),object position x(2),object position y(2),object position z(2))
if distance#<3
point object 2,object position x(1),object position y(1),object position z(1)
move object 2,0.05
endif
if distance#>3
move object 2,0
endif
sync
loop