here it is [dbpro] :
make_images()
sync on
sync rate 60
autocam off
set ambient light 100
color backdrop 0
make matrix 1,110,110,10,10
prepare matrix texture 1,1,1,1
make object cube 1,5
offset limb 1,0,0,2.5,0
texture object 1,4
set object collision on 1
make_rnd_level()
do
sync
move_player()
camera()
rot_col()
score=collect(score)
set cursor 0,0
text 0,0,"your score: "+str$(score)
text 0,30,"level: "+str$(level+1)
if score > 9
win_cam()
make_rnd_level()
level=level+1
score=0
endif
loop
function make_images()
ink rgb(255,255,255),0
box 0,0,50,50
ink rgb(123,123,123),0
for i = 1 to 30
dot rnd(20)+5,rnd(20)+5
next i
get image 1,5,5,25,25
cls
ink rgb(230,23,42),0
box 0,0,50,50
ink rgb(12,12,43),0
for i = 1 to 30
dot rnd(20)+5,rnd(20)+5
next i
get image 2,5,5,25,25
cls
ink rgb(255,255,0),0
box 0,0,50,50
ink rgb(255,255,23),0
for i = 1 to 30
dot rnd(20)+5,rnd(20)+5
next i
get image 3,5,5,25,25
cls
ink rgb(0,0,0),0
box 0,0,50,50
ink rgb(255,255,255),0
for i = 1 to 30
dot rnd(20)+5,rnd(20)+5
next i
get image 4,5,5,25,25
endfunction
function win_cam()
ox#=object position x(1)
oz#=object position z(1)
x#=ox#
z#=oz#
repeat
sync
center text screen width()/2,screen height()/2,"YOU WIN!! :D"
center text screen width()/2,screen height()/2+30,"press space"
ya#=ya#+2
set camera to follow x#,y#,z#,ya#,20,10,2,2
point camera ox#,4,oz#
until spacekey()=1
endfunction
function collect(score)
for i = 41 to 50
if object exist(i)=1
if object collision(1,i)>0
delete object i
inc score
endif
endif
next i
endfunction score
function rot_col()
for i = 41 to 50
if object exist(i)=1
ang=object angle x(i)
ang=ang+1
rotate object i,ang,ang,ang
endif
next i
endfunction
function make_rnd_level()
for i = 10 to 20
if object exist(i)=1 then delete object i
make object cube i,5
texture object i,2
position object i,rnd(100),2.5,rnd(100)
set object collision on i
next i
for i = 41 to 50
if object exist(i)=1 then delete object i
make object cube i,8
position object i,rnd(100),3,rnd(100)
set object collision on i
texture object i,3
next i
endfunction
function move_player()
ox=object position x(1)
oy=object position y(1)
oz=object position z(1)
oya=object angle y(1)
objyang#=object angle y(1)
if upkey()=1
move object 1,1
endif
if downkey()=1
move object 1,-1
endif
if leftkey()=1
objyang#=objyang#-4
endif
if rightkey()=1
objyang#=objyang#+4
endif
yrotate object 1,objyang#
for i = 10 to 20
if object collision(1,i)>0
position object 1,ox,oy,oz
yrotate object 1,oya
endif
next i
endfunction
function camera()
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
ya#=object angle y(1)
set camera to follow x#,y#,z#,ya#,20,20,2,2
point camera x#,y#,z#
endfunction
Joep
Do you need a complete FPS,3rdPS engine
?? Or a collision command libary?? well here it is:
http://forum.thegamecreators.com/?m=forum_view&t=38869&b=6&p=0