Posted: 11th May 2015 17:42
the program looks like this:
Sync on
sync rate 40
hide mouse
set display mode 1280,1024,32
set global collision on
global objektek
global obj
ship=1
rem load player
Load object "obj/ship.3DS",Ship
load image "obj/ship.jpg",Ship
scale object 1,50,50,50
texture object 1,1
position object 1,200,0,50
obj=15
objektek()
rem enemy
make object cube 2,5
position object 2,300,0,0
rem camera
position camera 160,350,140
rotate camera 90,0,0
life=100
do
text 20,20, "Life:"+str$(life)
text 20,50, "Score:"+str$(score)
Distance1 = Distance1 - 1.5
Turn = rnd(360)
Move object 2,5
if Distance1 < -50
yrotate object 2, wrapvalue(object angle Y(2) + Turn)
Distance1 = 0
endif
if object screen x(2)<0 then turn object right 2,180
if object screen x(2)>1280 then turn object left 2,180
if object screen y(2)<0 then pitch object down 2,180
if object screen y(2)>1000 then pitch object up 2,180
If Object collision(ship,2) then life=life-2
if object collision (ship,0)>0 then score=score+1
if object collision (ship,x)>0 delete object x
`get keyboard input to change the y variable
if rightkey()=1 then y=wrapvalue(y+5)
if leftkey()=1 then y=wrapvalue(y-5)
`move the object
if upkey()=1 then move object 1,5
if downkey()=1 then move object 1,-5
`yrotate the box
yrotate object 1,y
`update the screen
sync
loop
function objektek
For x = 10 to obj
Make object sphere x,5
Position object x,Rnd(300),0,Rnd(300)
Next x
endfunction