I have another question. I spent all day with my brother trying to get this code to word. I have a mouse retical, so ehn I move the mouse, the retical does as well. The problem is, when I move the craft, the mouse retical cannot move out of the screen to far. Here is my code;
`Hide mouse
hide mouse
` Load bitmaps
load bitmap "grass1.bmp",1
get image 1,0,0,256,256
delete bitmap 1
` Load music track
load music "Over5.mid",1
loop music 1
` Activate manual sync
sync on
` Make landscape and ceiling matrix
make matrix 1,2000,5000,10,25
prepare matrix texture 1,1,2,2
make matrix 2,2000,5000,10,25
prepare matrix texture 2,1,2,2
fill matrix 2,0,2
randomize matrix 2,350.0
for t=0 to 25
set matrix height 2,0,t,-100
set matrix height 2,10,t,-100
next t
update matrix 2
`Import cursor
load object "cusor.x",9
scale object 9,100000,100000,100000
`Make Screen
Make Object Cube 7,4
`Make Bullets
Make Object Sphere 4,2
hide object 4
Make Object Sphere 8,2
hide object 8
`Make Cockpit
load Object "gunL.x",1
load Object "gunR.x",2
`Make Gun
Make Object Cylinder 3,2
XRotate Object 3,90
Fix object pivot 3
Scale Object 3,100,100,500
Make Object Cylinder 6,2
XRotate Object 6,90
Fix object pivot 6
Scale Object 6,100,100,500
` Begin game loop
do
` Set seed for same random numbers
randomize 1
` Clear cave floor
fill matrix 1,0,1
` Set lighting, fog and setupset ambient light 20
color backdrop 0
if fog available()=1 then fog on : fog color 0 : fog distance 4000
` Reset speed
x=0
z=0
speed#=0.0
` Begin main loop
repeat
` Record old variables
oldx=x
oldgy#=gy#
`make mouse
mx#=mousex()+260
my#=mousey()*-1+260
oldmx#=mx#
oldmy#=my#
` Control key movements
if upkey()=1 then speed#=speed#+1.0 else speed#=speed#-1.0
if leftkey()=1 then rz#=rz#+1.0
if rightkey()=1 then rz#=rz#-1.0
if downkey()=1 then speed#=speed#-1.0
`Control gun movement
` Control variables
if speed#<0.0 then speed#=0.0
if speed#<10.0 then speed#=speed#+1.1
if speed#>40.0 then speed#=40.0
rz#=rz#/1.1
x=x-(2*rz#)
` Scroll landscape
z=z+speed#
if z>200
z=z-200
if rnd(3)=0
mp=mp-1
mp=mp+rnd(3)
if mp<1 then mp=1
if mp>4 then mp=4
endif
for t=0 to 0 : set matrix height 1,t,24,450 : set matrix tile 1,t,24,2 : next t
for t=1 to mp : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,2 : next t
for t=mp+1 to mp+1 : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,3 : next t
for t=mp+2 to mp+3 : set matrix height 1,t,24,rnd(20) : set matrix tile 1,t,24,1 : next t
for t=mp+4 to mp+4 : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,4 : next t
for t=mp+5 to 9 : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,2 : next t
for t=10 to 10 : set matrix height 1,t,24,450 : next t
update matrix 1
shift matrix up 1
shift matrix up 2
endif
`Position matrix
position matrix 1,0,0,2500-z
position matrix 2,0,100,2500-z
`Ghost on cube 7
Ghost object on 7
` Position camera
gy#=curvevalue(50+get ground height(1,500+x,z),gy#,3)
position camera 500+x,gy#,2500
zrotate camera wrapvalue(rz#)
Position Object 1,498+x,gy#,2500.7
Position Object 2,502+x,gy#,2500.7
Position object 3,498+x,gy#-5,2510
Position object 6,502+x,gy#-5,2510
Position object 7,497+x,gy#+1,2510
position object 9,mx#,my#,2800
disable object zdepth 9
`Fire bullets
If controlkey()=1
Position Object 4,498+x,gy#-5,2490
Position Object 8,502+x,gy#-5,2490
Set object to camera orientation 4
Set object to camera orientation 8
Show object 4
Show object 8
endif
Move object 4,20
Move object 8,20
` Update screen
sync
` End main loop when collision with ceiling
until get ground height(2,500+x,y)<gy#-100.0
` Return camera to point before collision
position camera 500+oldx,oldgy#,2500
` Game Over
for c=0 to 255 step 20
cls rgb(c,0,0)
if fog available()=1 then fog distance (c*5) : fog color (c*256*256)
sync
next c
` End game loop
Loop
Any help would be helpful. Thanx in advance!
Bishop
"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."