NEW UPDATED CODE:
sync rate 10
randomize timer()
`matrix
make matrix 1,1500,1500,60,60
randomize matrix 1,20
line 0,0,1,1
get image 1,0,0,rnd(2)+5,rnd(2)+5
prepare matrix texture 1,1,60,60
cls
`make guy
make object sphere 1,10
make object box 2,2,4,2
make mesh from object 1,2
make object box 3,1,2,1
make mesh from object 2,3
delete object 2
delete object 3
add limb 1,1,1
add limb 1,2,1
add limb 1,3,1
add limb 1,4,1
add limb 1,5,2
add limb 1,6,2
offset limb 1,1,2,-5,0 : rotate limb 1,1,90,0,0
offset limb 1,2,-2,-5,0 : rotate limb 1,2,90,0,0
offset limb 1,3,5,0,0
offset limb 1,4,-5,0,0
offset limb 1,5,6,0,1 : color limb 1,5,rgb(500,500,500)
offset limb 1,6,6,1,2 : rotate limb 1,6,90,0,0 : color limb 1,6,rgb(500,500,500)
position object 1,750,GET GROUND HEIGHT(1, object position x(1), object position z(1))+2,0
for begin=1 to 6
SET LIMB SMOOTHING 1,begin,80
next begin
`enemys
for begin=253 to 283
make object sphere begin,20
position object begin,rnd(1500)+250,0,rnd(1500)+100
color object begin,rgb(0,0,100)
next begin
`ammopacks
for begin=284 to 290
make object cylinder begin,5
x=rnd(1300)+100
z=rnd(1300)+100
position object begin,x,GET GROUND HEIGHT(1,x,z)+9,z
next begin
`shelters
for begin=291 to 345
sizex=rnd(10)+100
sizey=rnd(10)+100
make object plain begin,sizex,sizey
position object begin,rnd(1500)+250,sizey-sizey/2,rnd(1500)+100
next begin
`main
for begin=2 to 252
make object cube begin,1
next begin
curb=2
make camera 1
position camera 1,0,1,0
objdmg=20
make light 2
ammo=20
`loop
do
color backdrop rgb(0,0,0)
set cursor 550,10
print "FPS: ";screen fps ()
set cursor 5,10
print "health ";objdmg
print "ammo: ";ammo
if spacekey()
if ammo>0
position object curb,limb position x(1,6),limb position y(1,6),limb position z(1,6)
turn object right curb,object angle y(1)
ammo=ammo-1
curb=curb+1
if curb=251 then curb=2
endif
endif
if upkey()
if ca=0
rotate limb 1,1,90,0,0
rotate limb 1,2,100,0,0
ca=1
goto endthis1
endif
if ca=1
rotate limb 1,1,100,0,0
rotate limb 1,2,90,0,0
ca=0
goto endthis1
endif
endthis1:
move object 1,2.1
endif
if rightkey()
if ca2=0
rotate limb 1,1,90,0,0
rotate limb 1,2,100,0,0
ca2=1
goto endthis2
endif
if ca2=1
rotate limb 1,1,100,0,0
rotate limb 1,2,90,0,0
ca2=0
goto endthis2
endif
endthis2:
turn object right 1,rnd(1)+5
endif
if leftkey()
if ca3=0
rotate limb 1,1,90,0,0
rotate limb 1,2,100,0,0
ca3=1
goto endthis3
endif
if ca3=1
rotate limb 1,1,100,0,0
rotate limb 1,2,90,0,0
ca3=0
goto endthis3
endif
endthis3:
turn object left 1,rnd(1)+5
endif
if upkey()
if ca4=0
rotate limb 1,1,90,0,0
rotate limb 1,2,100,0,0
ca4=1
goto endthis4
endif
if ca4=1
rotate limb 1,1,100,0,0
rotate limb 1,2,90,0,0
ca4=0
goto endthis4
endif
endthis4:
move object 1,-1
endif
`bullet movment
for begin=2 to curb
move object begin,20
next begin
`simple AI
for begin=253 to 283
if object exist(begin)
r=rnd(1)
if r=0
turn object right begin,36
if r=1
turn object left begin,36
endif
endif
move object begin,1
if object position x(1)-object position x(begin)=<5 AND object position z(1)-object position z(begin)=<5
for wall=291 to 345
if object collision (begin,wall)
turn object right begin,100
move object begin,15
skip=1
endif
next wall
if skip=0
point object begin,object position x(1)+rnd(2),object position y(1),object position z(1)+rnd(5)
move object begin,rnd(1)+3
endif
endif
endif
skip=0
next begin
`bullet & enemy hit
for begin=253 to 283
for b=2 to 252
if object exist(begin)
if object exist(b)
if object collision (begin,b)
delete object begin
endif
if object visible (b)=0
delete object b
endif
endif
endif
next b
next begin
`ammo
for begin=284 to 290
rotate object begin,90,object angle y(begin)+6,0
if object collision (begin,1)
delete object begin
ammo=ammo+10
endif
next begin
`enemy dmg
for begin=253 to 283
if object exist(begin)
if object collision (1,begin)
objdmg=objdmg-1
if objdmg<=0
end
endif
endif
endif
next begin
`object/camera/light stuff
rotate limb 1,1,90,0,0
rotate limb 1,2,90,0,0
position camera 1,object position x(1)-object angle y(1), object position y(1)+10, object position z(1)-30
yrotate camera 1,object angle y(1)
position light 2,limb position x(1,6),limb position y(1,6),limb position z(1,6)
position object 1,object position x(1),GET GROUND HEIGHT(1, object position x(1), object position z(1))+9,object position z(1)
for begin=253 to 283
if object exist (begin)
position object begin,object position x(begin),GET GROUND HEIGHT(1, object position x(begin), object position z(begin))+9,object position z(begin)
endif
next begin
`end
loop
improvements:
better AI system, enemys dont all come rushing torwards you!
more coming!