If relative paths don't work, then it most likely means the current folder isn't the EXE's folder. So at the top of your program, drop in some code to get the current path when your game starts up, then check to see if your important folders like 'images' 'models' 'sound' etc exists in this path. If they don't, either print a meaningful failed error message to the screen (or log file), sync and wait for a key before ending. So when people run your game, they can give some type of useful feedback as to why it died, rather than .. it died..
Although looking at your original code snippet again, there's absolute paths sprinkled all through it. It'd be nice if we had the 'current' cleaned up version of the code to look at, but I'm guessing that you converted the paths you might have missed a path, which would make it fail..
The version of your snippet bellow, adds a bit of header to query the current folder and drop an error message / exit when the paths fails. I've changed all the media loads to use the games initial startup location as it's base path, so if you ever change the path while the program is running, it'll still be able to find the media files regardless.
REM edutainment
REM by abbas and sam
REM created 12/2/13 10:11 a.m.
rem ------------------------------------------------------------------------------
rem -[PRE-GAME-START-UP-VALIDATE]-------------------------------------------------
rem ------------------------------------------------------------------------------
rem the path our game started up in, in here we'll expect to find our media files
Global MEDIA_PATH$
Media_PAth$=Get Dir$()
rem here i'm assuming Media_Path$ doesn't have a back slach character after it,
rem it might be an idea to screen for this, just in case ! Since all the media loads
rem now use this variable as our programs base path.
rem check needed media folders exists
for StartupLp=1 to 3
if StartupLp=1 then MediaFOlder$="\Images"
if StartupLp=2 then MediaFOlder$="\Sounds"
if StartupLp=3 then MediaFOlder$="\Models"
if path exist(Media_PATH$+MediaFOlder$) = false
print MediaFOlder$+" folder is missing"
StartError=1
endif
next
if StartError
print "Startup Error - Folders Missing"
print "Current Path:"+Get dir$()
sync
wait key
end
endif
rem ------------------------------------------------------------------------------
rem -[GAME START]-----------------------------------------------------------------
rem ------------------------------------------------------------------------------
REM edutainment
REM by abbas and sam
REM created 12/2/13 10:11 a.m.
GameStart:
autocam off
hide mouse
sync on : sync rate 60 : sync
rem ****____****_____loading section____****____****
rem images
load image Media_Path$+"\images\sky_texture.jpg",1 rem load
load image Media_Path$+"\images\skyscraper2_texture.jpg",2 rem load
load image Media_Path$+"\images\skyscraper3_texture.jpg",5 rem load
load image Media_Path$+"\images\skyscraper1_texture.jpg",4 rem load
load image Media_Path$+"\images\skyscraper4_texture.jpg",7 rem load
load image Media_Path$+"\images\blue_splashscreen.jpg",8 rem load
load image Media_Path$+"\images\road_texture2.jpg",9 rem load
load image Media_Path$+"\images\blue_splash.jpg",12 rem load
rem sounds
load music Media_Path$+"\sounds\car_revving.mp3",1 rem load
load sound Media_Path$+"\sounds\car_explosion.wav",2 rem load
load sound Media_Path$+"\sounds\plane_fly1.wav",3 rem load
set sound volume 2,100
set sound volume 3,100
set music volume 1,100
paste image 8,0,0
sync
sleep 2500
rem ****____****____title intro thing____****____****
rem \/ start text page \/
sync
set text font "Comic Sans MS" : set text size 30 : set text to bold : set text transparent
delete image 8
sleep 1000
paste image 12,0,0
center text 320,20, "Welcome to a Friend in Need"
ink rgb(255,127,36),0
center text 321,21, "Welcome to a Friend in Need"
ink rgb(255,255,255),0
center text 320,50, "A Game About Transfering Energy"
ink rgb(255,127,36),0
center text 321,51, "A Game About Transfering Energy"
ink rgb(255,255,255),0
center text 320,425, "Press [A] to Continue"
ink rgb(255,127,36),0
center text 321,426, "Press [A] to Continue"
ink rgb(255,255,255),0
sync
do
if inkey$()="a"
do
if inkey$()<>"a" then cls : exit rem delete text
loop
exit
endif
loop
rem \/ start text page \/
sync
paste image 12,0,0
ink rgb(255,255,255),0
center text 320,20, "Drive to Your Friend Who"
ink rgb(255,127,36),0
center text 321,21, "Drive to Your Friend Who"
ink rgb(255,255,255),0
center text 320,50, "Is Low On Energy,"
ink rgb(255,127,36),0
center text 321,51, "Is Low On Energy,"
ink rgb(255,255,255),0
center text 320,80, "Only You Can Save Him!!!"
ink rgb(255,127,36),0
center text 321,81, "Only You Can Save Him!!!"
ink rgb(255,255,255),0
center text 320,425, "Press [A] to Continue"
ink rgb(255,127,36),0
center text 321,426, "Press [A] to Continue"
ink rgb(255,255,255),0
sync
do
if inkey$()="a"
do
if inkey$()<>"a" then cls : exit rem delete text
loop
exit
endif
loop
rem \/ start text page \/
sync
paste image 12,0,0
center text 321,50, "********************"
ink rgb(255,127,36),0
center text 320,51, "********************"
ink rgb(255,255,255),0
center text 320,80, "Press [P] To Play Easy Level"
ink rgb(255,127,36),0
center text 321,81, "Press [P] To Play Easy Level"
ink rgb(255,255,255),0
center text 320,110, "********************"
ink rgb(255,127,36),0
center text 321,111, "********************"
ink rgb(255,255,255),0
center text 320,140, "Press [O] To Play Medium Level"
ink rgb(255,127,36),0
center text 321,141, "Press [O] To Play Medium Level"
ink rgb(255,255,255),0
center text 320,170, "********************"
ink rgb(255,127,36),0
center text 321,171, "********************"
ink rgb(255,255,255),0
center text 320,200, "Press [I] To Play Expert Level"
ink rgb(255,127,36),0
center text 321,201, "Press [I] To Play Expert Level"
ink rgb(255,255,255),0
center text 320,230, "********************"
ink rgb(255,127,36),0
center text 321,231, "********************"
ink rgb(255,255,255),0
center text 320,260, "Press [U] To Play Bonus Level"
ink rgb(255,127,36),0
center text 321,261, "Press [U] To Play Bonus Level"
ink rgb(255,255,255),0
center text 320,290, "********************"
ink rgb(255,127,36),0
center text 321,291, "********************"
ink rgb(255,255,255),0
center text 320,390, "********************"
ink rgb(255,127,36),0
center text 321,391, "********************"
ink rgb(255,255,255),0
center text 320,420, "Please wait for game to load in and between levels"
ink rgb(255,127,36),0
center text 321,421, "Please wait for game to load in and between levels"
ink rgb(255,255,255),0
center text 320,450, "********************"
ink rgb(255,127,36),0
center text 321,451, "********************"
ink rgb(255,255,255),0
sync
do
if inkey$()="p"
do
if inkey$()<>"p" then cls :goto MainSection
loop
exit
endif
if inkey$()="o"
do
if inkey$()<>"o" then cls :goto NextLevelPlay
loop
exit
endif
if inkey$()="i"
do
if inkey$()<>"i" then cls :goto NextNextLevelPlay
loop
exit
endif
if inkey$()="u"
do
if inkey$()<>"u" then cls :goto PlaneLevelPlay
loop
exit
endif
loop
sync
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rem ****____****____MainSection Start____****____****
MainSection:
backdrop on
load object Media_Path$+"\models\nixanz.x",100
scale object 100, 150,150,150 rem scale obj
position object 100,0,-30,-75 rem position obj
rotate object 100,0,180,0 rem rotate obj
load object Media_Path$+"\models\nixanz.x",200
scale object 200,150,150,150 rem scale obj
position object 200,3900,-30,4000 rem pos obj
rotate object 200,0,-90,0 rem rotate obj
color backdrop rgb(0,10,210) rem backdrop
make matrix 1,15000,15000,20,20
position matrix 1,-2500,-45,-2500
prepare matrix texture 1,9,1,1
position camera 0,85,-5 rem pos camera
point camera 0,60,60 rem point camera
set camera range 1,3500 rem define range
play music 1 rem play music
loop music 1 rem loop music
rem ****____****____ other oject creation ____****____****
for i= 1 to 50
make object cube i,50 rem make object
scale object i,350,750,360 rem scale
position object i,0+rnd(4000),50,0+rnd(4000) rem position
texture object i,2 rem texture
next i
for j= 141 to 190
make object cube j,50 rem make obj
scale object j,400,675,380 rem scale
position object j,0+rnd(3500),50,0+rnd(3500) rem position
texture object j,5 rem texture
next j
for k= 201 to 230
make object cube k,50 rem make obj
scale object k,300,600,375 rem scale
position object k,0+rnd(2000),50,0+rnd(2000) rem position
texture object k,7 rem texture
next k
for l= 231 to 245
make object cube l,50 rem make obj
scale object l,450,600,400 rem scale
position object l,0+rnd(5000),50,0+rnd(5000) rem position
texture object l,7 rem texture
next l
for m= 261 to 280
make object cube m,50 rem make obj
scale object m,375,600,375 rem scale
position object m,0+rnd(5000),50,0+rnd(5000) rem position
texture object m,7 rem texture
next m
for q= 51 to 72
load object Media_Path$+"\models\tank.x",q
position object q,0+rnd(4000),-21,0+rnd(4000) rem position
scale object q,7,7,7
color object q,rgb(255,0,0)
next q
for h= 102 to 131
make object sphere h,10 rem make object
position object h,0+rnd(4000),-30,0+rnd(4000) rem pos obj
next h
rem ****____****____ game loop with Collision and Motion Section ____****____****
set text font "Comic Sans MC" : set text size 19 : set text to bold : set text transparent
BOOST# = 1000
HEALTH# = 1000
ENERGY# = 1000
timerv = 3600
do
rem store angle
ay# = object angle Y(100)
rem key input
if upkey()=1 then move object 100,-2.45 rem pos move
if downkey()=1 then move object 100,2.45 rem neg move
if leftkey()=1 then ay# = wrapvalue(ay#-2.5) rem neg turn
if rightkey()=1 then ay# = wrapvalue(ay#+2.5) rem pos turn
if BOOST# > 0 and spacekey()=1 rem if boost is > 0 then
move object 100,-3.15 : cdn# = cnd# - 15 rem only then can u boost : - cam dist
endif
if inkey$()="q" then end rem end
rem rotate object
yrotate object 100,ay#
`------------------------------------
cdn# = 8 rem cam dist var
rem \/ get camera to follow \/
set camera to follow object position x(100), object position y(100), object position z(100), object angle y(100), -15, 15, cdn#, 0
rem ****____****____ boost and health section ____****____****
boostout=BOOST#/10
healthout=HEALTH#/10
energyout=ENERGY#/10
text 0,0, "POWER = " + str$(boostout) rem boost on screen
text 335,0, "ENERGY = " + str$(energyout) rem energy on screen
text 530,0, "HEALTH = " + str$(healthout) rem health on screen
center text 320,420, "GO TO THE NORTH EAST CONRER OF THE CITY"
center text 320,440, "USE THE ARROW KEYS TO MOVE | SPACEBAR TO BOOST"
center text 320,460, "COLLECT THE GAS CANS FOR POWER | ORBS FOR HEALTH"
if spacekey()=1 and BOOST#>0 then BOOST# = BOOST# - 1 rem decrease boost
if BOOST# < 100 rem if boost is less than 10
dec HEALTH#,1 rem decrease my health
endif
if BOOST# < 200
dec ENERGY#,1
endif
rem ****____****____ collision for buildings section start ____****____****
if object collision(100,200) and ENERGY# > 0
position object 100,x#,y#,z#
dec ENERGY#,1
endif
if ENERGY# = 0
goto NextLevelSequence
endif
for i= 1 to 50 rem for 1 to 50 then
if object collision(100,i) rem if i collide then
HEALTH# = HEALTH# - 1 rem decrese health
position object 100,x#,y#,z# rem disable pass thru\
play sound 2
endif
next i rem restart collision
for j=141 to 190 rem for 141 - 190
if object collision(100,j) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next j rem restart collision
for k=201 to 230 rem for 141 - 190
if object collision(100,k) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next k rem restart collision
for l=231 to 245 rem for 141 - 190
if object collision(100,l) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next l rem restart collision
for m=261 to 280 rem for 141 - 190
if object collision(100,m) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next m rem restart collision
for q= 51 to 72 rem for 51 - 80
if object collision(100,q) rem if collsiion
BOOST# = BOOST# + 100 rem boost is increased
exclude object on q rem remov obj from view
endif
next q rem restart collision
for h= 102 to 131 rem for 102 - 131
if object collision(100,h) rem if collsiion
HEALTH# = HEALTH# + 100 rem boost is increased
exclude object on h rem remov obj from view
endif
next q rem restart collision
x# = object position x(100) rem x pos
y# = object position y(100) rem y pos
z# = object position z(100) rem z pos
`*******how to get to the endsection*****
if HEALTH# = 0
goto EndSection
endif
`****____****____ star ttimer section ____****____****
dec timerv,1
timerout=timerv/60
center text 230,0, "Time = " + str$(timerout)
if timerv = 0
goto EndSection
endif
sync
loop
rem ****____****____ next level section start ____****____****
NextLevelSequence:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
delete objects 1,6000
delete matrix 1
cls 0
goto NextLevelPlay
end
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
`*************************************************************************************************************************
rem ****____****____MainSection Start____****____****
NextLevelPlay:
backdrop on
load object Media_Path$+"\models\nixanz.x",100
scale object 100, 150,150,150 rem scale obj
position object 100,0,-30,-75 rem position obj
rotate object 100,0,180,0 rem rotate obj
load object Media_Path$+"\models\nixanz.x",200
scale object 200,150,150,150 rem scale obj
position object 200,3900,-30,4000 rem pos obj
rotate object 200,0,-90,0 rem rotate obj
color backdrop rgb(0,10,210) rem backdrop
make matrix 1,15000,15000,20,20
position matrix 1,-2500,-45,-2500
prepare matrix texture 1,9,1,1
position camera 0,85,-5 rem pos camera
point camera 0,60,60 rem point camera
set camera range 1,3500 rem define range
play music 1 rem play music
loop music 1 rem loop music
rem ****____****____ other oject creation ____****____****
for i= 1 to 50
make object cube i,50 rem make object
scale object i,350,750,360 rem scale
position object i,0+rnd(4000),50,0+rnd(4000) rem position
texture object i,2 rem texture
next i
for j= 141 to 190
make object cube j,50 rem make obj
scale object j,400,675,380 rem scale
position object j,0+rnd(3500),50,0+rnd(3500) rem position
texture object j,5 rem texture
next j
for k= 201 to 230
make object cube k,50 rem make obj
scale object k,300,600,375 rem scale
position object k,0+rnd(2000),50,0+rnd(2000) rem position
texture object k,7 rem texture
next k
for l= 231 to 245
make object cube l,50 rem make obj
scale object l,450,600,400 rem scale
position object l,0+rnd(5000),50,0+rnd(5000) rem position
texture object l,7 rem texture
next l
for m= 261 to 280
make object cube m,50 rem make obj
scale object m,375,600,375 rem scale
position object m,0+rnd(5000),50,0+rnd(5000) rem position
texture object m,7 rem texture
next m
for q= 51 to 72
load object Media_Path$+"\models\tank.x",q
position object q,0+rnd(4000),-21,0+rnd(4000) rem position
scale object q,7,7,7
color object q,rgb(255,0,0)
next q
for h= 102 to 131
make object sphere h,10 rem make object
position object h,0+rnd(4000),-30,0+rnd(4000) rem pos obj
next h
rem ****____****____ game loop with Collision and Motion Section ____****____****
set text font "Comic Sans MC" : set text size 19 : set text to bold : set text transparent
BOOST# = 1000
HEALTH# = 1000
ENERGY# = 1000
timerv = 2700
do
rem store angle
ay# = object angle Y(100)
rem key input
if upkey()=1 then move object 100,-2.45 rem pos move
if downkey()=1 then move object 100,2.45 rem neg move
if leftkey()=1 then ay# = wrapvalue(ay#-2.5) rem neg turn
if rightkey()=1 then ay# = wrapvalue(ay#+2.5) rem pos turn
if BOOST# > 0 and spacekey()=1 rem if boost is > 0 then
move object 100,-3.15 : cdn# = cnd# - 15 rem only then can u boost : - cam dist
endif
if inkey$()="q" then end rem end
rem rotate object
yrotate object 100,ay#
`------------------------------------
cdn# = 8 rem cam dist var
rem \/ get camera to follow \/
set camera to follow object position x(100), object position y(100), object position z(100), object angle y(100), -15, 15, cdn#, 0
rem ****____****____ boost and health section ____****____****
boostout=BOOST#/10
healthout=HEALTH#/10
energyout=ENERGY#/10
text 0,0, "POWER = " + str$(boostout) rem boost on screen
text 335,0, "ENERGY = " + str$(energyout) rem energy on screen
text 530,0, "HEALTH = " + str$(healthout) rem health on screen
center text 320,420, "GO TO THE NORTH EAST CORNER OF THE CITY"
center text 320,440, "USE THE ARROW KEYS TO MOVE | SPACEBAR TO BOOST"
center text 320,460, "COLLECT THE GAS CANS FOR POWER | ORBS FOR HEALTH"
if spacekey()=1 and BOOST#>0 then BOOST# = BOOST# - 1 rem decrease boost
if BOOST# < 100 rem if boost is less than 10
dec HEALTH#,1 rem decrease my health
endif
if BOOST# < 200
dec ENERGY#,1
endif
rem ****____****____ collision for buildings section start ____****____****
if object collision(100,200) and ENERGY# > 0
position object 100,x#,y#,z#
dec ENERGY#,1
endif
if ENERGY# = 0
goto NextNextLevelSequence
endif
for i= 1 to 50 rem for 1 to 50 then
if object collision(100,i) rem if i collide then
HEALTH# = HEALTH# - 1 rem decrese health
position object 100,x#,y#,z# rem disable pass thru\
play sound 2
endif
next i rem restart collision
for j=141 to 190 rem for 141 - 190
if object collision(100,j) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next j rem restart collision
for k=201 to 230 rem for 141 - 190
if object collision(100,k) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next k rem restart collision
for l=231 to 245 rem for 141 - 190
if object collision(100,l) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next l rem restart collision
for m=261 to 280 rem for 141 - 190
if object collision(100,m) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next m rem restart collision
for q= 51 to 72 rem for 51 - 80
if object collision(100,q) rem if collsiion
BOOST# = BOOST# + 100 rem boost is increased
exclude object on q rem remov obj from view
endif
next q rem restart collision
for h= 102 to 131 rem for 102 - 131
if object collision(100,h) rem if collsiion
HEALTH# = HEALTH# + 100 rem boost is increased
exclude object on h rem remov obj from view
endif
next q rem restart collision
x# = object position x(100) rem x pos
y# = object position y(100) rem y pos
z# = object position z(100) rem z pos
`*******how to get to the endsection*****
if HEALTH# = 0
goto EndSection
endif
`****____****____ star ttimer section ____****____****
dec timerv,1
timerout=timerv/60
center text 230,0, "Time = " + str$(timerout)
if timerv = 0
goto EndSection
endif
sync
loop
rem ****____****____ next level section start ____****____****
NextNextLevelSequence:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
delete objects 1,6000
delete matrix 1
cls 0
goto NextNextLevelPlay
end
`**************************************************************************************************************************
`/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
`**************************************************************************************************************************
rem ****____****____MainSection Start____****____****
NextNextLevelPlay:
load object Media_Path$+"\models\nixanz.x",100
scale object 100, 150,150,150 rem scale obj
position object 100,0,-30,-75 rem position obj
rotate object 100,0,180,0 rem rotate obj
load object Media_Path$+"\models\nixanz.x",200
scale object 200,150,150,150 rem scale obj
position object 200,3900,-30,4000 rem pos obj
rotate object 200,0,-90,0 rem rotate obj
color backdrop rgb(0,10,210) rem backdrop
make matrix 1,15000,15000,20,20
position matrix 1,-2500,-45,-2500
prepare matrix texture 1,9,1,1
position camera 0,85,-5 rem pos camera
point camera 0,60,60 rem point camera
set camera range 1,3500 rem define range
play music 1 rem play music
loop music 1 rem loop music
rem ****____****____ other oject creation ____****____****
for i= 1 to 50
make object cube i,50 rem make object
scale object i,350,750,360 rem scale
position object i,0+rnd(4000),50,0+rnd(4000) rem position
texture object i,2 rem texture
next i
for j= 141 to 190
make object cube j,50 rem make obj
scale object j,400,675,380 rem scale
position object j,0+rnd(3500),50,0+rnd(3500) rem position
texture object j,5 rem texture
next j
for k= 201 to 230
make object cube k,50 rem make obj
scale object k,300,600,375 rem scale
position object k,0+rnd(2000),50,0+rnd(2000) rem position
texture object k,7 rem texture
next k
for l= 231 to 245
make object cube l,50 rem make obj
scale object l,450,600,400 rem scale
position object l,0+rnd(5000),50,0+rnd(5000) rem position
texture object l,7 rem texture
next l
for m= 261 to 280
make object cube m,50 rem make obj
scale object m,375,600,375 rem scale
position object m,0+rnd(5000),50,0+rnd(5000) rem position
texture object m,7 rem texture
next m
for q= 51 to 72
load object Media_Path$+"\models\tank.x",q
position object q,0+rnd(4000),-21,0+rnd(4000) rem position
scale object q,7,7,7
color object q,rgb(255,0,0)
next q
for h= 102 to 131
make object sphere h,10 rem make object
position object h,0+rnd(4000),-30,0+rnd(4000) rem pos obj
next h
rem ****____****____ game loop with Collision and Motion Section ____****____****
set text font "Comic Sans MC" : set text size 19 : set text to bold : set text transparent
BOOST# = 1000
HEALTH# = 1000
ENERGY# = 1000
timerv = 1800
do
rem store angle
ay# = object angle Y(100)
rem key input
if upkey()=1 then move object 100,-2.45 rem pos move
if downkey()=1 then move object 100,2.45 rem neg move
if leftkey()=1 then ay# = wrapvalue(ay#-2.5) rem neg turn
if rightkey()=1 then ay# = wrapvalue(ay#+2.5) rem pos turn
if BOOST# > 0 and spacekey()=1 rem if boost is > 0 then
move object 100,-3.15 : cdn# = cnd# - 15 rem only then can u boost : - cam dist
endif
if inkey$()="q" then end rem end
rem rotate object
yrotate object 100,ay#
`------------------------------------
cdn# = 8 rem cam dist var
rem \/ get camera to follow \/
set camera to follow object position x(100), object position y(100), object position z(100), object angle y(100), -15, 15, cdn#, 0
rem ****____****____ boost and health section ____****____****
boostout=BOOST#/10
healthout=HEALTH#/10
energyout=ENERGY#/10
text 0,0, "POWER = " + str$(boostout) rem boost on screen
text 335,0, "ENERGY = " + str$(energyout) rem energy on screen
text 530,0, "HEALTH = " + str$(healthout) rem health on screen
center text 320,420, "GO TO THE NORTH EAST CORNER OF THE CITY"
center text 320,440, "USE THE ARROW KEYS TO MOVE | SPACEBAR TO BOOST"
center text 320,460, "COLLECT THE GAS CANS FOR POWER | ORBS FOR HEALTH"
if spacekey()=1 and BOOST#>0 then BOOST# = BOOST# - 1 rem decrease boost
if BOOST# < 100 rem if boost is less than 10
dec HEALTH#,1 rem decrease my health
endif
if BOOST# < 200
dec ENERGY#,1
endif
rem ****____****____ collision for buildings section start ____****____****
if object collision(100,200) and ENERGY# > 0
position object 100,x#,y#,z#
dec ENERGY#,1
endif
if ENERGY# = 0
goto EndSectionWin
endif
for i= 1 to 50 rem for 1 to 50 then
if object collision(100,i) rem if i collide then
HEALTH# = HEALTH# - 1 rem decrese health
position object 100,x#,y#,z# rem disable pass thru\
play sound 2
endif
next i rem restart collision
for j=141 to 190 rem for 141 - 190
if object collision(100,j) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next j rem restart collision
for k=201 to 230 rem for 141 - 190
if object collision(100,k) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next k rem restart collision
for l=231 to 245 rem for 141 - 190
if object collision(100,l) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next l rem restart collision
for m=261 to 280 rem for 141 - 190
if object collision(100,m) rem if collision
HEALTH# = HEALTH# - 1 rem dec health
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next m rem restart collision
for q= 51 to 72 rem for 51 - 80
if object collision(100,q) rem if collsiion
BOOST# = BOOST# + 100 rem boost is increased
exclude object on q rem remov obj from view
endif
next q rem restart collision
for h= 102 to 131 rem for 102 - 131
if object collision(100,h) rem if collsiion
HEALTH# = HEALTH# + 100 rem boost is increased
exclude object on h rem remov obj from view
endif
next q rem restart collision
x# = object position x(100) rem x pos
y# = object position y(100) rem y pos
z# = object position z(100) rem z pos
`*******how to get to the endsection*****
if HEALTH# = 0
goto EndSection
endif
`****____****____ star ttimer section ____****____****
dec timerv,1
timerout=timerv/60
center text 230,0, "Time = " + str$(timerout)
if timerv = 0
goto EndSection
endif
sync
loop
`**************************************************************************************************************************
`/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
`**************************************************************************************************************************
PlaneLevelPlay:
backdrop on
load object Media_Path$+"\models\MIG-21.3ds",100
scale object 100, 25,25,25 rem scale obj
position object 100,0,150,-200 rem position obj
rotate object 100,0,90,0 rem rotate obj
color object 100,rgb(125,20,30)
color backdrop rgb(0,125,255) rem backdrop
make matrix 1,15000,15000,20,20
position matrix 1,-2500,-45,-2500
prepare matrix texture 1,9,1,1
make matrix 2,15000,15000,1,1
position matrix 2,-2500,550,-2500
prepare matrix texture 2,1,1,1
play sound 3
loop sound 3
position camera 0,85,-5 rem pos camera
point camera 0,60,60 rem point camera
set camera range 1,3500 rem define range
rem ****____****____ other oject creation ____****____****
for i= 1 to 50
make object cube i,50 rem make object
scale object i,350,750,360 rem scale
position object i,0+rnd(4000),50,0+rnd(4000) rem position
texture object i,2 rem texture
next i
for j= 141 to 190
make object cube j,50 rem make obj
scale object j,400,675,380 rem scale
position object j,0+rnd(3500),50,0+rnd(3500) rem position
texture object j,5 rem texture
next j
for k= 201 to 230
make object cube k,50 rem make obj
scale object k,300,600,375 rem scale
position object k,0+rnd(2000),50,0+rnd(2000) rem position
texture object k,7 rem texture
next k
for l= 231 to 245
make object cube l,50 rem make obj
scale object l,450,600,400 rem scale
position object l,0+rnd(5000),50,0+rnd(5000) rem position
texture object l,7 rem texture
next l
for m= 261 to 280
make object cube m,50 rem make obj
scale object m,375,600,375 rem scale
position object m,0+rnd(5000),50,0+rnd(5000) rem position
texture object m,7 rem texture
next m
rem ****____****____ game loop with Collision and Motion Section ____****____****
do
if 2*2 = 4 then move object 100,2
rem store angle
ay# = object angle Y(100)
ax# = object angle X(100)
rem key input
if leftkey()=1 then ay# = wrapvalue(ay#-2.5) rem neg turn
if rightkey()=1 then ay# = wrapvalue(ay#+2.5) rem pos turn
if upkey()=1 then ax# = wrapvalue(ax#+2.5) rem neg turn
if downkey()=1 then ax# = wrapvalue(ax#-2.5) rem pos turn
if spacekey()=1 rem if boost is > 0 then
move object 100,5.15 : cdn# = cnd# - 15 rem only then can u boost : - cam dist
endif
if inkey$()="q" then goto EndSectionPlane rem endsection
rem rotate object
yrotate object 100,ay#
xrotate object 100,ax#
`------------------------------------
cdn# = 8 rem cam dist var
rem \/ get camera to follow \/
set camera to follow object position x(100), object position y(100), object position z(100), object angle y(100), 155, 65, cdn#, 0
rem ****____****____ boost and health section ____****____***
set text font "Comic Sans MC" : set text size 19 : set text to bold : set text transparent
center text 320,420, "PRESS "Q" TO QUIT"
center text 320,440, "USE SPACE TO MOVE | UP/DOWN KEYS TO DIVE"
center text 320,460, "ENJOY THE VIEW | TRY TO DO SOME CRAZY TRICKS"
rem ****____****____ collision for buildings section start ____****____****
for i= 1 to 50 rem for 1 to 50 then
if object collision(100,i) rem if i collide then
position object 100,x#,y#,z# rem disable pass thru
play sound 2
endif
next i rem restart collision
for j=141 to 190 rem for 141 - 190
if object collision(100,j) rem if collision
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next j rem restart collision
for k=201 to 230 rem for 141 - 190
if object collision(100,k) rem if collision
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next k rem restart collision
for l=231 to 245 rem for 141 - 190
if object collision(100,l) rem if collision
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next l rem restart collision
for m=261 to 280 rem for 141 - 190
if object collision(100,m) rem if collision
position object 100,x#,y#,z# rem pos obj
play sound 2
endif
next m rem restart collision
x# = object position x(100) rem x pos
y# = object position y(100) rem y pos
z# = object position z(100) rem z pos
`*******how to get to the endsection*****
if inkey$()="q" then end
sync
loop
EndSection:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
backdrop off
delete objects 1,6000
delete matrix 1
delete music 1
delete sound 2
delete sound 3
cls 0
center text 320,200,"YOU LOSE!"
center text 320,240,"PLAY AGAIN [Y/N]?"
sync
DO
REM CONTROL INPUT
if Inkey$()="y"
goTO GameStart
endif
if Inkey$()="n"
cls : end
endif
REM REFRESH SCREEN
sync
loop
EndSectionWin:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
backdrop off
delete objects 1,6000
delete matrix 1
delete music 1
delete sound 2
delete sound 3
cls 0
center text 320,200,"YOU WIN!"
center text 320,240,"PLAY AGAIN [Y/N]?"
sync
DO
REM CONTROL INPUT
if Inkey$()="y"
goTO GameStart
endif
if Inkey$()="n"
cls : end
endif
REM REFRESH SCREEN
sync
loop
EndSectionPlane:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
backdrop off
delete objects 1,6000
delete matrix 1
delete music 1
delete sound 2
delete sound 3
cls 0
center text 320,200,"YOU'RE DONE???"
center text 320,240,"MAIN MENU??? [Y/N]?"
sync
DO
REM CONTROL INPUT
if Inkey$()="y"
goTO GameStart
endif
if Inkey$()="n"
cls : end
endif
REM REFRESH SCREEN
sync
loop
end
wait key