I've had some troubles with a space project and stripped it down to this:
Sync on
Sync rate 30
make matrix 1, 1000,1000,10,10
make object box 51, 5,1,3
position object 51, i, i, i
set object rotation ZYX 51
make object box 10,10,2,5
position object 10,1000,0,1000
set camera view 0,0,screen width(),screen height() / 2
set camera aspect 0,screen width() /(screen height() / 2)
color backdrop 0, 0
MAKE camera 1
set camera view 1, 0,screen height() / 2,screen width(),screen height()
CLEAR CAMERA VIEW 1, 0
color backdrop 1, 0
speed = 5
cam = 51
hide mouse
Do
move object 51, 5
Point object 51, object position x(10),object position y(10),object position z(10)
position mouse 50,50
if upkey() = 1 then move object 10, 5
if downkey() = 1 then move object 10,-5
if leftkey() = 1 then roll object left 10,1
if rightkey() = 1 then roll object right 10,1
turn object right 10, mousemovex()/5
pitch object up 10, mousemovey()/5
camera_junk()
sync
Loop
function camera_junk()
position camera 0, object position x(10),object position y(10),object position z(10)
set camera to object orientation 0, 10
pitch camera down 0,15
move camera 0, - 60
pitch camera up 0, 15
cam = 51
while object exist(cam) = 0
cam = cam + 1
EndWhile
position camera 1, object position x(cam),object position y(cam),object position z(cam)
set camera to object orientation 1, cam
pitch camera down 1,15
move camera 1, - 60
pitch camera up 1, 15
endfunction
You control the top box, and the bottom box should come to you, however, in some places the bottom box goes off to nowhereland. I stumped.
Controls:
Mouselook: turn pitch
Arrow keys: move/roll
Any help would be greatly appreciated!!
"There will always be evil, for, without evil, the good shall lose their virtue."