Here is my code... I can't seem to grasp the concept of the chase cam... what is wrong?
thanks,
Christian
Rem Project: Space net game
Rem Created: 6/13/2005 2:06:24 PM
`load all junk and hide mouse
ship = 1
hide mouse
load object "starfighter.3ds",ship
load image "blueworld.jpg",2
load image "moon.jpg",3
`position starfighter
position object ship, 20,20,20
rotate object ship,270,0,0
rem stars
for f=1 to 50 : e=rnd(255) : dot rnd(255),rnd(255),rgb(e,e,e) : next f : get image 1,0,0,256,256
rem star sphere
make object sphere 99,30000000000000,20,20 : texture object 99,1
scale object texture 99,8,8 : set object 99,1,0,0,0,0,0,0
rem set camera to see stars
set camera range 1,30000000000000
rem create planet
make object sphere 100,2300000,20,20 : texture object 100,2
position object 100, 2300000,2300000,23000
`create a moon for our planet
make object sphere 101,400000,20,20 :texture object 101,3
position object 101,2300000+43000,230000+ 33000,4000
`position camera
position camera -1000,-1000,-1000
rem declare all variables
distance# = 20
speed = 0
sync on
do
sync
gosub player_control
gosub camera_distance
gosub object_tracker
gosub throttle
move camera speed
sync
loop
rem takes care of all speed issues
throttle:
if upkey() = 1 then speed = speed + 1
if downkey() = 1 then speed = speed - 1
if speed < 1 then speed = 1
if speed > 6000 then speed = 6000
return
` tracks ship
object_tracker:
posx#=object position x(ship)
posy#=object position y(ship)
posz#=object position z(ship)
rem Update with new object position
position object ship,posx#,posy#,posz#
return
position camera posx# * distance#,posy# * distance,posz# * distance
REM << point camera at very center of cube
point camera posx#,posy# + 2,posz#
return
` effects camera distance with distance#
camera_distance:
if leftkey() = 1 then distance# = distance# + .05
if rightkey() = 1 then distance# = distance# - .05
return
`all of the free flight controls
player_control:
if keystate(17) = 1 then pitch object down ship,2
if keystate(31) = 1 then pitch object up ship,2
if keystate(30) = 1 and st = 0 then roll object left ship,2 else if keystate(30) = 1 and st = 1 then tr = tr - 1
if keystate(32) = 1 and st = 0 then roll object right ship,2 else if keystate(32) = 1 and st = 1 then tr = tr + 1
if tr < -15 then tr = -15
if tr > 15 then tr = 15
if tr < 0 then tr = tr + 0.1
if tr > 0 then tr = tr - 0.1
roll object right ship,tr
return