Hi I am starting up again but managed to get myself stuck , have a syntax nestling error at line 595
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM Solar Dominion Functions
REM Author :Ian George aka Vampyre
REM ****************************************************************
REM ****************************************************************
REM ****************************************************************
REM ****************************************************************
autocam off
hide mouse
sync rate 60
sync on
Rem Bckdrop On
Backdrop on
REM FOG
Fog on
Fog distance 4000
Fog color RGB(128,128,128)
Color Backdrop RGB(128,128,128)
REM Make Matrix
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
rem Randomize the matrix
randomize matrix 1,125
update matrix 1
X#=5000
Z#=5000
rem Set text font
set text font "Westminister"
ink rgb(200,255,0),0
set text size 15
player = 1
hovercraft = 2
aircraft= 3
do
` Gosub _playerview
if cammode = 1 : ` third person
move object 3,1
move object 2,-150
position object 3,object position x(2),object position y(2),object position z(2)
move object 2,150
rem Place camera and set orientation to object
position camera object position x(3),object position y(3),object position z(3)
set camera to object orientation 2
Endif
move object 3,1
do
gosub _Input
gosub _UpdateAircraft
gosub _UpdateHovercraft
gosub _UpdatePlayer
gosub _UpdateCam
gosub _ShowAnimations
gosub _HUD
gosub _LoadObjects
gosub _UpdateVehicle
sync
loop
if cammode = 0 and inVehicle = 0
if object collision(3,hover) = 1 then inVehicle = 2 : set camera to object orientation hover
if object collision(3,plane) = 1 then inVehicle = 1 : set camera to object orientation plane
endif
if inVehicle = 0 then gosub _MovePlayer
if inVehicle = 1 then center text screen width() / 2,10,"In plane." : hide object player
if inVehicle = 2 then center text screen width() / 2,10,"In hover." : hide object player
if scancode()=35 = 1 : ` pressed h
if inVehicle = 1
` normally, you would gradually slow the vehicle down and then have the player get out of it
x# = object position x(plane)
y# = object position y(plane)
z# = object position z(plane)
y# = get ground height(1,x# + 40,z# + 40)
position object player,(x# + 40),y#,(z# + 40)
show object player
endif
if inVehicle = 2
` normally, you would gradually slow the vehicle down and then have the player get out of it
x# = object position x(hover)
y# = object position y(hover)
z# = object position z(hover)
y# = get ground height(1,x# + 40,z#)
position object player,(x# + 40),y#,(z# + 40)
show object player
endif
inVehicle = 0 : cammode = 1
endif
gosub _HUD
sync
loop
Function Case()
_UpdateVehicle:
select inVehicle
case 1
` in airplane
gosub _UpdateAircraft
endcase
case 2
` in hover
gosub _UpdateHovercraft
endcase
endselect
return
EndFunction Case
Function PlayerControls()
_UpdatePlayer:
if inVehicle = 0
playerAngX# = wrapvalue(playerAngX# + mousemovey()*0.25)
playerAngY# = wrapvalue(playerAngY# + mousemovex()*0.25)
if keystate(17)
playerX# = newxvalue(playerX#,playerAngY#,1.0)
playerZ# = newzvalue(playerZ#,playerAngY#,1.0)
endif
if keystate(31)
playerX# = newxvalue(playerX#,playerAngY#,-1.0)
playerZ# = newzvalue(playerZ#,playerAngY#,-1.0)
endif
if keystate(30)
playerX# = newxvalue(playerX#,wrapvalue(playerAngY#-90.0),1.0)
playerZ# = newzvalue(playerZ#,wrapvalue(playerAngY#-90.0),1.0)
endif
if keystate(32)
playerX# = newxvalue(playerX#,wrapvalue(playerAngY#+90.0),1.0)
playerZ# = newzvalue(playerZ#,wrapvalue(playerAngY#+90.0),1.0)
endif
playerY# = 3.0
else
playerAngX# = wrapvalue(playerAngX# + mousemovey()*0.25)
playerAngY# = carAngY#
playerX# = newxvalue(carX#,wrapvalue(carAngY#-45.0),3.0)
playerZ# = newzvalue(carZ#,wrapvalue(carAngY#-45.0),3.0)
playerY# = 5.0
endif
position object player,playerX#,playerY#,playerZ#
rotate object player,0.0,playerAngY#,0.0
return
EndFunction Controls
Function UpdateHovercraft
_UpdateHovercraft:
rem hovercraft controls
if invehicle=2
if cammode = 0 then hide object 2
if cammode = 1 then show object 2
mmy=mousemovey()
mmx=mousemovex()
if mmy>0 then pitch object up 2,0.002
if mmy<0 then pitch object down 2,0.002
if mmx<0 then turn object left 2,5
if mmx>0 then turn object right 2,5
if upkey()=1 then move object 2,4
if downkey()=1 then move object 2,-4
if scancode()=17 then move object 2,4
if scancode()=31 then move object 2,-4
if joystick up()=1 then pitch object up 2,0.0002
if joystick down()=1 then pitch object down 2,0.0002
if joystick left()=1 then turn object left 2,5
if joystick right()=1 then turn object right 2,5
if joystick slider a()=0 then move object 2,4
if joystick slider a()=65535 then move object 2,-4
if joystick z() = -1000 then move object 2,20
if joystick z() = 1000 then move object 2,-20
REM Straffe Left
if joystick twist z()=-1000 then turn object left 2,90 : move object 2,20 : turn object right 2,90
REM Straffe Right
if joystick twist z()=1000 then turn object right 2,90 : move object 2,20 : turn object left 2,90
REM Straffe Left
if scancode()=30 then turn object left 2,90 : move object 2,20 : turn object right 2,90
REM Straffe Right
if scancode()=32 then turn object right 2,90 : move object 2,20 : turn object left 2,90
REM Straffe Left
if leftkey()=1 then turn object left 2,90 : move object 2,20 : turn object right 2,90
REM Straffe Right
if rightkey()=1 then turn object right 2,90 : move object 2,20 : turn object left 2,90
REM Hovercaft Jump
if jumpb=1 then height#=height#-0.7
if joystick fire x(4) or spacekey()=1
if ajump=1
jumpb=1
height#=20
endif
endif
if height#<-13 then height#=-13
if object position y(2)>100 then ajump=0 else ajump=1
position object 2,object position x(2),object position y(2)+height#,object position z(2)
if object position y(2)<10 then jumpb=0:height#=0
if cammode = 0
x# = object position x(hover)
y# = object position y(hover)+ 3.2
z# = object position z(hover)
position camera x#,y#,z#
set camera to object orientation hover
move camera -5
if ksNum8 = 1 or jhat = 0 : ` numpad 8 key -- look forward
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
endif
if ksNum4 = 1 or jhat = 27000 : ` numpad 4 key -- look left
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
yrotate camera wrapvalue(camera angle y() - 90.0)
endif
if ksNum6 = 1 or jhat = 9000 : ` numpad 6 key -- look right
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
yrotate camera wrapvalue(camera angle y() + 90.0)
endif
if ksNum2 = 1 or jhat = 18000 : ` numpad 2 key -- look backward
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
yrotate camera wrapvalue(camera angle y() - 180.0)
endif
endif
endif
return
if ctrl = 1
inVehicle = 0
playerX# = newxvalue(hoverX#,wrapvalue(hoverAngY#-90.0),12.0)
endif
else
if ctrl = 1
if (playerX#-hoverX#)^2+(playerZ#-hoverZ#)^2 <= 160
inVehicle = 1
endif
endif
position object hover,hoverX#,hoverY#,hoverZ#
rotate object hover,hoverAngX#,hoverAngY#,hoverAngZ
EndFunction Controls
Function AircraftControls()
_UpdateAircraft:
rem air/spacecraft movement controls
if inVehicle = 1
if cammode = 0 then hide object plane
if cammode = 1 then show object plane
mmy=mousemovey()
mmx=mousemovex()
if mmy>0 then pitch object up 4,2
if mmy<0 then pitch object down 4,2
if mmx<0 then turn object left 4,5
if mmx>0 then turn object right 4,5
if upkey()=1 then move object plane,2 : ` W
if downkey()=1 then move object plane,-2 : ` S
if scancode()=17 then move object plane,2 : ` W
if scancode()=32 then move object plane,2 : `S
if inkey$() = "q" then roll object left 2,5: `Q
if inkey$() = "e" then roll object right 2,5: `E
if scancode()=211 then roll object left 4,2
if scancode()=209 then roll object right 4,2
if Joystick Up() = 1 then pitch object down 4,2
if Joystick Down() = 1 then pitch object up 4,2
if Joystick Left() = 1
turn object left 4,2 : turn camera left 2
set camera to object orientation plane
endif
if Joystick Right() = 1
turn object right 4,2 : turn camera right 2
set camera to object orientation plane
endif
if Joystick Twist Z() = 1000 then roll object left 4,2
if Joystick Twist Z()= -1000 then roll object right 4,2
if Joystick Slider A() = 0 then move object 4,20
if Joystick Slider A() = 65535 then move object 4,-20
REM Straffe Left
if joystick fire x(4)=1 or lfk = 1 or ks30 = 1
turn camera left 90.0 : move camera 5 : turn camera right 90.0
turn object left plane,90 : move object plane,5 : turn object right plane,90
endif
REM Straffe Right
if joystick fire x(5)=1 or rgk = 1 or ks32 = 1
turn object right plane,90 : move object plane,5 : turn object left plane,90
turn camera right 90 : move camera 5 : turn camera left 90
endif
rem VTOL take off and landing
if joystick fire x(6) = 1 or control = 1
position object plane,object position x(4),object position y(4)+height,object position z(4):height=10
endif
if joystick fire x(7) or SPACE = 1
position object plane,object position x(plane),object position y(plane)-10,object position z(plane):height=height-1
endif
x# = object position x(plane)
y# = object position y(plane)+5.2
z# = object position z(plane)
position camera x#,y#,z#
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
move camera -5
if ksNum8 = 1 or jhat = 0 : ` numpad 8 key -- look forward
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
endif
if ksNum4 = 1 or jhat = 27000 : ` numpad 4 key -- look left
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
yrotate camera wrapvalue(camera angle y() - 90.0)
endif
if ksNum6 = 1 or jhat = 9000 : ` numpad 6 key -- look right
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
yrotate camera wrapvalue(camera angle y() + 180.0)
endif
if ksNum2 = 1 or jhat = 18000 : ` numpad 2 key -- look backward
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
yrotate camera wrapvalue(camera angle y() - 180.0)
endif
endif
return
if ctrl = 1
inVehicle = 0
playerX# = newxvalue(planeX#,wrapvalue(planeAngY#-90.0),12.0)
endif
if ctrl = 1
if (playerX#-planeX#)^2+(playerZ#-planeZ#)^2 <= 160
inVehicle = 1
endif
endif
position object plane,planeX#,planeY#,planeZ#
rotate object plane,planeAngX#,planeAngY#,planeAngZ
EndFunction Controls
rem HAT control
jhat=joystick hat angle(0)
print westminster
text 10,10,"HAT signal: "+str$(jhat)
text 10,20,"Joystick: "+str$(jx)+"/"+str$(jy)
text 10,30,"Slider: "+str$(joystick slider a())
text 10,40,"FPS: "+str$(screen fps())
text 320,400,"Speed: "+str$(intspeed)+"MPH"
rem Set the hat look flags to nothing
lookUp = 0: lookLeft = 0: lookRight = 0: lookBack = 0
if jhat = 0 then lookUp = 1
if jhat=9000 or jhat=4500 or jhat=13500 then lookRight = 1
if jhat=31500 or jhat=27000 or jhat=22500 then lookLeft = 1
if jhat = 18000 then lookBack = 1
If InKey$() = "1" Then cammode = 1 : ` third person
If InKey$() = "2" Then cammode = 0 : ` first person
If cammode = 0
rem Place camera and set orientation to object for FPS
position camera object position x(2),object position y(2),object position z(2)
set camera to object orientation 2
if lookRight = 1 then turn camera right 90.0
if lookLeft = 1 then turn camera left 90.0
if lookUp = 1 then pitch camera up 45.0
if lookBack = 1 then turn camera right 180.0
else
Function InAndOutOfVehicles()
if inVehicle = 0
if cammode = 1
` check collision with player to plane and hovercraft
if object collision(player,hover) = 1 then inVehicle = 2 : hide object player
if object collision(player,plane) = 1 then inVehicle = 1 : hide object player
endif
endif
if inVehicle = 0
if cammode = 0
` check collision with player to plane and hovercraft
if object collision(player,hover) = 1 then inVehicle = 2 : hide object player
if object collision(player,plane) = 1 then inVehicle = 1 : hide object player
endif
endif
EndFunction Vehicles
Function UpdateCam()
_UpdateCam:
if inVehicle = 0
if playerView = 0
camX# = playerX#
camY# = playerY# + 2.5
camZ# = playerZ#
camAngX# = playerAngX#
camAngY# = playerAngY#
else
camX# = newxvalue(playerX#,wrapvalue(playerAngY#+180.0),25.0)
camY# = newyvalue(playerY#,playerAngX#,-25.0)
camZ# = newzvalue(playerZ#,wrapvalue(playerAngY#+180.0),25.0)
camAngX# = playerAngX#
camAngY# = playerAngY#
endif
else
if playerView = 0
camX# = playerX#
camY# = playerY# + 2.5
camZ# = playerZ#
camAngX# = 0.0
camAngY# = hoverAngY#
else
camX# = newxvalue(hoverX#,wrapvalue(hoverAngY#+180.0),25.0)
camY# = newyvalue(hoverY#,hoverAngX#,-25.0)
camZ# = newzvalue(hoverrZ#,wrapvalue(hoverAngY#+180.0),25.0)
camAngX# = hoverAngX#
camAngY# = AngY#
endif
endif
position camera camX#,camY#,camZ#
rotate camera camAngX#,camAngY#,0.0
return
if inVehicle = 0
if playerView = 0
camX# = playerX#
camY# = playerY# + 2.5
camZ# = playerZ#
camAngX# = playerAngX#
camAngY# = playerAngY#
else
camX# = newxvalue(playerX#,wrapvalue(playerAngY#+180.0),25.0)
camY# = newyvalue(playerY#,playerAngX#,-25.0)
camZ# = newzvalue(playerZ#,wrapvalue(playerAngY#+180.0),25.0)
camAngX# = playerAngX#
camAngY# = playerAngY#
endif
else
if playerView = 0
camX# = playerX#
camY# = playerY# + 2.5
camZ# = playerZ#
camAngX# = 0.0
camAngY# = planeAngY#
else
camX# = newxvalue(planeX#,wrapvalue(planeAngY#+180.0),25.0)
camY# = newyvalue(planeY#,planeAngX#,-25.0)
camZ# = newzvalue(planeZ#,wrapvalue(planeAngY#+180.0),25.0)
camAngX# = hoverAngX#
camAngY# = AngY#
endif
endif
position camera camX#,camY#,camZ#
rotate camera camAngX#,camAngY#,0.0
return
EndFunction Cam
Function LoadObjects
_LoadObjects:
rem Make drone to mark a back position
make object sphere 3,10
hide object 3
set object collision on 3
make object collision box 3,-5,-5,-5,5,5,5,1
rem Load Tank Autocannon
`Load object 1,2
`XRotate Object 1,90
`Fix object pivot 1
`Scale object 1,100,100,500
`position object 1,0,-7,15
`Lock object on 1
player = 1
REM player object
LOAD OBJECT "Babe\H-Babe-Idle.x",player
frames = total object frames(player)
idle(1,1) = 1 : idle(1,2) = frames
append object "Babe\H-Babe-Attack1.x",player,frames + 1
attack1(1,1) = frames +1
frames = total object frames(player)
attack1(1,2) = frames
append object "Babe\H-Babe-move.x",player,frames + 1
move(1,1) = frames + 1
frames = total object frames(player)
move(1,2) = frames
append object "Babe\H-Babe-Impact.x",player,frames + 1
Impact(1,1) = frames + 1
frames = total object frames(player)
Impact(1,2) = frames
append object "Babe\H-Babe-Die.x",player,frames + 1
Die(1,1) = frames + 1
frames = total object frames(player)
Die(1,2) = frames
append object "Babe\H-Babe-Static.x",player,frames + 1
Static(1,1) = frames + 1
frames = total object frames(player)
Static(1,2) = frames
set object speed player,30
SCALE OBJECT player,300,300,300
YROTATE OBJECT player,180
FIX OBJECT PIVOT player
set object collision on player
make object collision box player,-2,-2,-2,2,2,2,1
REM Get Ground Height
x# = 100.0
z# = 100.0
Y# = Get ground height(1,X#,Z#)
Position object player, X#,Y#,Z#
cy# = get ground height(1,0,0)
position camera 0,cy# + 1.5,0
plane = 4
REM Aircraft Object
load object "Box.X", plane
scale object plane,200,200,200
REM Object Collisions
Set object collision to spheres plane
set object collision on plane
rem Rotate and fix data so character faces right way
rotate object plane,0,180,0
fix object pivot plane
x# = 200.0
z# = 200.0
Position object plane, X#,Y# + 1.54,Z#
make object collision box plane,-28,-8,-12,32,8,12,1
rem Hovercraft Object
hover = 2
load object "BOX.3ds",hover
scale object hover,50,50,50
rem Rotate and fix data so character faces right way
rotate object hover,0,260,0
fix object pivot hover
X# = 150.0
z# = 150.0
REM Get Ground Height
Y# = Get ground height(1,X#,Z#)
Position object hover, X#,Y#,Z#
set object collision on hover
make object collision box hover,-30,-4,-32,10,4,32,2
EndFunction Objects
Function Showanimations()
_ShowAnimations:
text 10,10,"Press F1 to see die animation"
text 10,30,"Press F2 to see Attack1 animation."
text 10,50,"Press F3 to see Move animation."
text 10,70,"Press F4 to see Static animation."
text 10,90,"Press F5 to see Impact animation."
if object playing(player) = 1 then stop object player
if keystate(59) = 1 then play object player,die(1,1),die(1,2)
if keystate(60) = 1 then play object player,attack1(1,1),attack1(1,2)
if keystate(61) = 1 then play object player,move(1,1),move(1,2)
if keystate(62) = 1 then play object player,static(1,1),static(1,2)
if keystate(63) = 1 then play object player,impact(1,1),impact(1,2)
return
EndFunction Animations
Function HUD()
_HUD:
print westminster
text 10,10,"HAT signal: "+str$(jhat)
text 10,20,"Joystick: "+str$(jx)+"/"+str$(jy)
text 10,30,"Slider: "+str$(joystick slider a())
text 10,40,"FPS: "+str$(screen fps())
text 320,400,"Speed: "+str$(intspeed)+"MPH"
return
EndFunction HUD