shure thing, i give you full permishion for this code, alot of it is mine, alot is sniplets found here, and the rest is from the help editor. most of it is explained so replacing my media with yours should be easiy. if you need my help let me know.
edit
the menu folder with all the loading images are in the download bellow, this way you will have a loading bar.
REM Project: Jacks Graduation
REM Created: 12/6/2009 11:47:59 PM
REM
REM ***** Main Source File *****
REM
` set up general properties
sync on:sync rate 30:autocam off:set display mode 1280,768,32:set dir "Files":BACKDROP OFF
menu:
cls
load image "menu\1.jpg",1,1:load image "menu\hud.jpg",2,1:load music "audio\daydreaming.mp3",1:paste image 1,0,35:sync
rem *****************************************************************************************
Rem ******** MENU TEXT COLOR *********
Rem *****************************************************************************************
Global Standard : Standard = RGB(255,255,255):Global Selected : Selected = RGB(280,280,255)
Rem *****************************************************************************************
Rem ******** MENU LOOP *********
Rem *****************************************************************************************
Do
sync:SET TEXT SIZE 25:show mouse:play music 1:TEXT 250,100,"JACKS GRADUATION":If HyperLink(250,250,"Play game") = 1 Then gosub entername
If HyperLink(250,450,"Exit Game") = 1 Then end
If HyperLink(250,350,"load game") = 1 Then gosub loadGame
loop
Rem *****************************************************************************************
Rem ******** enter name loop *********
Rem *****************************************************************************************
entername:
do
sync:set text size 28:SET CURSOR 500,1:INPUT "enter your name:>";name$
if returnkey()=1
gosub playlevalone
endif
loop
Rem *****************************************************************************************
Rem ******** load leval one *********
Rem *****************************************************************************************
playlevalone:
rem delete menu music
delete music 1
Rem *****************************************************************************************
Rem ******** load music and images for loading *********
Rem *****************************************************************************************
load music "audio\power-juice.mp3",600:load image "menu\loading 1.jpg",2,0:load image "menu\loadingbarbox.png",3,0:load image "menu\loadingbar1.png",4,0:load image "menu\loadingbar2.png",5,0:load image "menu\loadingbar3.png",6,0:load image "menu\loadingbar4.png",7,0:load image "menu\loadingbar5.png",8,0:load image "menu\loadingbar6.png",9,0:load image "menu\loadingbar7.png",10,0:load image "menu\loadingbar8.png",11,0
cls
paste image 2,0,55:paste image 3,365,600:paste image 4,375,613:Text 555,650,"LOADING:":sync
loop music 600:hide mouse:disable escapekey
Rem *****************************************************************************************
Rem ******** global integers and floats *********
Rem *****************************************************************************************
Playr = 3
d# = 80.0
h# = 60.0
s# = 10.0
points=0
Timed=0
text1=1
collected1=2
randomize timer()
global numSpheres as integer : numSpheres = 5
global radius# as double float : radius# = 7.0
global littleRadius# as double float : littleRadius# = 2.0
global rtimer as integer
global stimer as integer
global vtimer as integer
rem player movement vector
global vx# as double float
global vy# as double float
global vz# as double float
global gravity# as double float : gravity# = -0.1
global slope# as double float : slope# = 0.5
global ground as integer : ground = 1
global jumptimer as integer : jumptimer = 0
global syncmode as integer : syncmode = 5
global view as integer : view = 1
global hide as integer : hide = 0
type Save_Load_File
`position data
Obj_Pos_X#
Obj_Pos_Y#
Obj_Pos_Z#
`rotation data
Obj_Ang_X#
Obj_Ang_Y#
Obj_Ang_Z#
` size data
Obj_Size_X#
Obj_Size_Y#
Obj_Size_Z#
endtype
Rem *****************************************************************************************
Rem ******** position camera and make sky *********
Rem *****************************************************************************************
position camera 0,2251.35,67.0998,-3894.95
realrange#=15000.0
set camera range 2.0,realrange#
` load our skybox
load object "skybank\ww2\Cty\cty.X", 2
set object light 2, 0
set object texture 2, 3, 1
set object cull 2,1
sk#=(100*(realrange#-8000))/5.0
scale object 2,sk#,sk#,sk#
Rem *****************************************************************************************
Rem ******** load in all objects *********
Rem *****************************************************************************************
` load the level and make a static mesh for it
load object "levelbank\testlevel\universe.dbo", 1:set object light 1, 0:sc_setupComplexObject 1,1,2
cls
paste image 2,0,55:paste image 3,365,600:paste image 5,375,613:Text 555,650,"LOADING:":sync
rem Load player model and shader effect
load object "entitybank\plr\jack.X",3:load effect "entitybank\plr\DetailMapping.dbs",1,1:set object effect 3,1:scale object 3,75,75,75:position object 3,2249, 15, -3850:sc_setupObject 3,0,1
rem load points box
load object "entitybank\items\envelope.x",4:load image "entitybank\items\envelope.dds",1:texture object 4,1:scale object 4,60,60,60:position object 4,2249, 30, -3535:loop object 4,0,30:set object speed 4,50
rem coppies
load object "entitybank\items\envelope.x",5:texture object 5,1:scale object 5,60,60,60:position object 5,2249, 30, -3435:loop object 5,0,35:set object speed 5,50
load object "entitybank\items\envelope.x",6:texture object 6,1:scale object 6,60,60,60:position object 6,2171, 30, -3204:loop object 6,0,35:set object speed 6,50
cls
paste image 2,0,55:paste image 3,365,600:paste image 6,375,613:Text 555,650,"LOADING:":sync
load object "entitybank\items\envelope.x",7:texture object 7,1:scale object 7,60,60,60:position object 7,2327, 30, -2902:loop object 7,0,35:set object speed 7,50
load object "entitybank\items\envelope.x",8:texture object 8,1:scale object 8,60,60,60:position object 8,2282, 30, -2180:loop object 8,0,35:set object speed 8,50
load object "entitybank\items\envelope.x",9:texture object 9,1:scale object 9,60,60,60:position object 9,2633, 30, -2897:loop object 9,0,35:set object speed 9,50
load object "entitybank\items\envelope.x",10:texture object 10,1:scale object 10,60,60,60:position object 10,2744, 30, -3171:loop object 10,0,35:set object speed 10,50
load object "entitybank\items\envelope.x",11:texture object 11,1:scale object 11,60,60,60:position object 11,2907, 30, -3396:loop object 11,0,35:set object speed 11,50
load object "entitybank\items\envelope.x",12:texture object 12,1:scale object 12,60,60,60:position object 12,3084, 30, -3587:loop object 12,0,35:set object speed 12,50
load object "entitybank\items\envelope.x",13:texture object 13,1:scale object 13,60,60,60:position object 13,2439, 30, -1962:loop object 13,0,35:set object speed 13,50
load object "entitybank\items\envelope.x",14:texture object 14,1:scale object 14,60,60,60:position object 14,2560, 30, -1747:loop object 14,0,35:set object speed 14,50
load object "entitybank\items\envelope.x",15:texture object 15,1:scale object 15,60,60,60:position object 15,2741, 30, -1507:loop object 15,0,35:set object speed 15,50
cls
paste image 2,0,55:paste image 3,365,600:paste image 7,375,613:Text 555,650,"LOADING:":sync
load object "entitybank\items\envelope.x",16:texture object 16,1:scale object 16,60,60,60:position object 16,3137, 30, -1720:loop object 16,0,35:set object speed 16,50
load object "entitybank\items\envelope.x",17:texture object 17,1:scale object 17,60,60,60:position object 17,3196, 30, -1903:loop object 17,0,35:set object speed 17,50
load object "entitybank\items\envelope.x",18:texture object 18,1:scale object 18,60,60,60:position object 18,3781, 30, -1868:loop object 18,0,35:set object speed 18,50
load object "entitybank\items\envelope.x",19:texture object 19,1:scale object 19,60,60,60:position object 19,3483, 30, -1528:loop object 19,0,35:set object speed 19,50
load object "entitybank\items\envelope.x",20:texture object 20,1:scale object 20,60,60,60:position object 20,1154, 30, -1119:loop object 20,0,35:set object speed 20,50
load object "entitybank\midevil brigade pack\talking people\man 4.X",21:load image "entitybank\midevil brigade pack\talking people\man 4_D.jpg",20:texture object 21,20:scale object 21,90,90,90:position object 21,3100, 2, -2018:set object speed 21,50:sc_setupObject 21,1,1
rem load game items
load object "entitybank\items\artifact.X",22:load image "entitybank\items\artifact_D.dds",30:texture object 22,30:position object 22,25.8882, 2, -1945.34:set object collision off 22:hide object 22
rem new 2
load object "entitybank\items\envelope.x",23:texture object 23,1:scale object 23,60,60,60:position object 23,2881, 30, -874:loop object 23,0,35:set object speed 23,50
load object "entitybank\items\envelope.x",24:texture object 24,1:scale object 24,60,60,60:position object 24,2478, 30, -643:loop object 24,0,35:set object speed 24,50
load object "entitybank\items\envelope.x",25:texture object 25,1:scale object 25,60,60,60:position object 25,2218, 30, -1120:loop object 25,0,35:set object speed 25,50
load object "entitybank\items\envelope.x",26:texture object 26,1:scale object 26,60,60,60:position object 26,690, 30, -294:loop object 26,0,35:set object speed 26,50
load object "entitybank\items\envelope.x",27:texture object 27,1:scale object 27,60,60,60:position object 27,148, 30, -276:loop object 27,0,35:set object speed 27,50
load object "entitybank\items\envelope.x",28:texture object 28,1:scale object 28,60,60,60:position object 28,2555, 30, -387:loop object 28,0,35:set object speed 28,50
load object "entitybank\items\envelope.x",29:texture object 29,1:scale object 29,60,60,60:position object 29,3354, 30, -256:loop object 29,0,35:set object speed 29,50
cls
paste image 2,0,55:paste image 3,365,600:paste image 8,375,613:Text 555,650,"LOADING:":sync
load object "entitybank\items\envelope.x",30:texture object 30,1:scale object 30,60,60,60:position object 30,1338, 30, -1715:loop object 30,0,35:set object speed 30,50
load object "entitybank\items\envelope.x",31:texture object 31,1:scale object 31,60,60,60:position object 31,1132, 30, -2781:loop object 31,0,35:set object speed 31,50
load object "entitybank\items\envelope.x",32:texture object 32,1:scale object 32,60,60,60:position object 32,625, 30, -2601:loop object 32,0,35:set object speed 32,50
load object "entitybank\Characters2\guard 1.X",33:load effect "entitybank\Characters2\guard 1.fx",2,1:set object effect 33,2:position object 33,2282, 3, -2415:fix object pivot 33:scale object 33,80,80,80:sc_setupComplexObject 33,1,2
load object "entitybank\Characters2\guard 1.X",34:set object effect 34,2:position object 34,3740, 3, -1610:fix object pivot 34:scale object 34,80,80,80:sc_setupComplexObject 34,1,2
cls
paste image 2,0,55:paste image 3,365,600:paste image 9,375,613:Text 555,650,"LOADING:":sync
load object "entitybank\Characters2\guard 1.X",35:set object effect 35,2:position object 35,100.1587, 3, -1462.73:fix object pivot 35:scale object 35,80,80,80:sc_setupComplexObject 35,1,2
load object "entitybank\Characters2\guard 1.X",36:set object effect 36,2:position object 36,3133, 3, -615:fix object pivot 36:scale object 36,80,80,80:sc_setupComplexObject 36,1,2
cls
paste image 2,0,55:paste image 3,365,600:paste image 10,375,613:Text 555,650,"LOADING:":sync
rem make trigger boxes
REM FRIEND 1 TRIGGERS
make object box 500,150,30,150:position object 500,3100, 2, -2018:set object collision on 500:hide object 500
make object box 501,150,30,150:position object 501,3100, 2, -2018:set object collision on 501:hide object 501
REM SECURITY GUARD 1 TRIGGERS
make object box 503,150,30,150:position object 503,2282, 3, -2415:hide object 503
make object box 504,150,30,150:position object 504,2249, 2, -3850:hide object 504
REM SECURITY GUARD 2 TRIGGERS
make object box 505,40,200,40:position object 505,3740, 3, -1610:hide object 505
make object box 506,40,200,40:position object 506,3421, 3, -1745:hide object 506
REM SECURITY GUARD 3 TRIGGERS
make object box 507,40,200,40:position object 507,100.157, 3, -1462:hide object 507
make object box 508,40,200,40:position object 508,239, 3, -1449:hide object 508
REM SECURITY GUARD 4 TRIGGERS
make object box 509,40,200,40:position object 509,3133, 3, -615:hide object 509
make object box 510,40,200,40:position object 510,2218, 3, -588:hide object 510
rem make collision boxes
make object box 502,40,200,40:position object 502,2282, 3, -2415:sc_setupComplexObject 502,1,2:hide object 502
T=Timer()
load music "audio\lovers-walk.mp3",1:load music "audio\walk.wav",2:load music "audio\you win 1.wav",3:load sound "audio\Boink.wav",1:load sound "audio\blowkiss.wav",2:load sound "audio\pick.wav",3:load image "menu\Instructions hud.jpg",7:load image "entitybank\items\artifact.jpg",6
` come out of the media directory
delete music 600
cls
paste image 2,0,55:paste image 3,365,600:paste image 11,375,613:Text 555,650,"LOADING:":sync
` our main loop
displayinstructions=1
do
If Inkey$()="p"
wait key
wait 200
Endif
if displayinstructions=1
paste image 7,150,100
if returnkey()=1
displayinstructions=0
endif
endif
if keystate(23)=1
displayinstructions=1
if returnkey()=1
displayinstructions=0
endif
endif
Rem *****************************************************************************************
Rem ******** PRINT NAME TO SCREEN *********
Rem *****************************************************************************************
set cursor 1,1:PRINT "You are, ";name$
Rem *****************************************************************************************
Rem ******** SAVE LOAD FETURE *********
Rem *****************************************************************************************
if keystate (31)=1 then save=1
if save=1 then SaveGame():if returnkey()=1 then save=0
if keystate(38)=1 then loadGame()
Rem *****************************************************************************************
Rem ******** PLAYER POINTS *********
Rem *****************************************************************************************
if text1=1 then PRINT "collect all your credit points":PRINT "YOU HAVE 10 MINUTES"
Rem *****************************************************************************************
Rem ******** RUN MODE *********
Rem *****************************************************************************************
if keystate (19)=1
runmode=1
endif
if runmode=1
if upkey()=1
move object 3,3
move camera 2.5
animestate#=4
endif
endif
if keystate(17)=1
runmode=0
endif
Rem *****************************************************************************************
Rem ******** BACK TO MENU *********
Rem *****************************************************************************************
if escapekey()=1 then delete objects 1,100:delete music 1:delete music 2:delete music 3:delete sound 1:delete sound 2:delete sound 3:delete image 1:delete image 2:delete image 3:delete image 4:gosub menu
Rem *****************************************************************************************
Rem ******** MORE ON POINTS *********
Rem *****************************************************************************************
Text 1100,1,"POINTS":Text 1100,20,str$(points):for hitbox2= 23 to 32:for hitbox= 4 to 20
Rem *****************************************************************************************
Rem ******** GAME TIMER *********
Rem *****************************************************************************************
Seconds=(Timer()-T)/1000
If Seconds>=60
Inc Minutes
If Minutes>=60
Inc Hours
If Hours>=24
Hours=0
Endif
Minutes=0
Endif
Seconds=0
T=Timer()
Endif
Hrs$=Str$(Hours)
If Hours<10 Then Hrs$="0"+Hrs$
Min$=Str$(Minutes)
If Minutes<10 Then Min$="0"+Min$
Sec$=Str$(Seconds)
If Seconds<10 Then Sec$="0"+Sec$
Text 900,1,"timer"+":"+Min$+":"+Sec$
Rem *****************************************************************************************
Rem ******** FIRST LEVEL LOOSE *********
Rem *****************************************************************************************
If Minutes>=10 then delete objects 1,100:delete music 1:delete music 2:delete music 3:delete sound 1:delete sound 2:delete sound 3:delete image 1:delete image 2:delete image 3:delete image 4:gosub menu
If Seconds>=30 then text1=0
Rem *****************************************************************************************
Rem ******** COLLISION TRIGGERS *********
Rem *****************************************************************************************
if object collision (3,501)=0 then animestated#=0
if object collision (3,500)=0 then talk=0
if object collision (3,500)=1 then set object collision on 22:show object 22:talk=1
if talk=1 then center text screen width()/2,screen height()-300,"hello there,i need your help,":center text screen width()/2,screen height()-200,"I lost something gold and shiny,":center text screen width()/2,screen height()-100,"you find this item and ill give you 30 points,"
if object collision (3,501)=1 then animestated#=1
if object collision (3,22)=1 then play sound 3:collected1=1
if collected1=1 then paste image 5,1,2:hide object 22:set object collision off 22:Text 70,1,"inventory items":Text 1,70,"gold artifact"
if object collision (3,500)=1 and collected1=1 then play sound 3:collected1=0:points=points+30:set object collision off 500:thanks1=1
if object collision (3,501)=1 and thanks1=1 then center text screen width()/2,screen height()-400,"thanks for your help, now i can rest well,"
if object collision (3,hitbox2)=1 then points=points+10:play sound 3:hide object hitbox2:set object collision off hitbox2
if object collision (3,hitbox)=1 then points=points+10:play sound 3:hide object hitbox:set object collision off hitbox
if points=290 then stop music 1:Text 300,500,"wow,that was a little tiring, I need to rest":Text 300,600,"congratulations, you made it to the next level!":loop music 3
next
next
Rem *****************************************************************************************
Rem ******** LOOP LEVEL MUSIC *********
Rem *****************************************************************************************
loop music 1
Rem *****************************************************************************************
Rem ******** TEXT display instructions *********
Rem *****************************************************************************************
SET TEXT SIZE 30:INK RGB(255,255,255),0:set cursor 0, 0
Rem *****************************************************************************************
Rem ******** Sky stays with camera *********
Rem *****************************************************************************************
if object exist(2)=1 then position object 2,camera position x(0),camera position y(0),camera position z(0)
if object exist(502)=1 then position object 502,object position x(33),object position y(33),object position z(33):sc_updateObject 502
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 1 MOVES WITH TRIGGER ZONES *********
Rem *****************************************************************************************
if object collision (33,503)=1 then move=1:move2=0
if move=1 then animestatedg#=1:move object 33,2:point object 33,object position x(504),object position y(504),object position z(504)
if object collision (33,504)=1 then move2=1:move=0
if move2=1 then animestatedg#=1:move object 33,2:point object 33,object position x(503),object position y(503),object position z(503)
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 2 MOVES WITH TRIGGER ZONES *********
Rem *****************************************************************************************
if object collision (34,505)=1 then move3=1:move4=0
if move3=1 then sc_updateobject 34: animestatedg2#=1:move object 34,2:point object 34,object position x(506),object position y(506),object position z(506)
if object collision (34,506)=1 then move4=1:move3=0
if move4=1 then sc_updateobject 34:animestatedg2#=1:move object 34,2:point object 34,object position x(505),object position y(505),object position z(505)
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 3 MOVES WITH TRIGGER ZONES *********
Rem *****************************************************************************************
if object collision (35,507)=1 then move5=1:move6=0
if move5=1 then sc_updateobject 35:animestatedg3#=1:move object 35,2:point object 35,object position x(508),object position y(508),object position z(508)
if object collision (35,508)=1 then move6=1:move5=0
if move6=1 then sc_updateobject 35:animestatedg3#=1:move object 35,2:point object 35,object position x(507),object position y(507),object position z(507)
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 4 MOVES WITH TRIGGER ZONES *********
Rem *****************************************************************************************
if object collision (36,509)=1 then move7=1:move8=0
if move7=1 then sc_updateobject 36:animestatedg4#=1:move object 36,2:point object 36,object position x(510),object position y(510),object position z(510)
if object collision (36,510)=1 then move8=1:move7=0
if move8=1 then sc_updateobject 36:animestatedg4#=1:move object 36,2:point object 36,object position x(509),object position y(509),object position z(509)
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 1 RUNS AND STOPS PLAYER *********
Rem *****************************************************************************************
if runmode=0 then guard1attack=0
if runmode=1 and upkey()=1 then guard1attack=1
if guard1attack=1 then move object 33,4:point object 33,object position x(3),object position y(3),object position z(3)
if object collision (3,33)=1 then stop object 33:guarddissabled1=1
if guarddissabled1=1 then hide object 33:sc_setobjectcollisionoff 33:sc_setobjectcollisionoff 502:move=0:move2=0
Rem *****************************************************************************************
Rem ******** plr ANIMATIONS *********
Rem *****************************************************************************************
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
if leftkey()=1 then yrotate object 3,wrapvalue(object angle y(3)-2)
if rightkey()=1 then yrotate object 3,wrapvalue(object angle y(3)+2)
rem idle animation
if animestate#=0 then loop object 3,2498,2700:set object speed 3,20
rem walk animation
if animestate#=1 then loop object 3,235,259:set object speed 3,50
rem jump animation
if animestate#=2 then loop object 3:set object speed 3,50
rem thumbs up animation
if animestate#=3 then loop object 3,2701,2790
rem run animation
if animestate#=4 then loop object 3,300,318:set object speed 3,100
Rem *****************************************************************************************
Rem ******** FRIENDS ANIMATIONS *********
Rem *****************************************************************************************
rem idle animation
if animestated#=0 then loop object 21,2522,3000:set object speed 21,100
rem talk animation
if animestated#=1 then loop object 21,3001,3218:set object speed 21,100
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 1 ANIMATIONS *********
Rem *****************************************************************************************
rem idle animation
if animestatedg#=0 then loop object 33,210,233:set object speed 33,100
rem walk animation
if animestatedg#=1 then loop object 33,235,259:set object speed 33,100
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 2 ANIMATIONS *********
Rem *****************************************************************************************
rem idle animation
if animestatedg2#=0 then loop object 34,2522,3000:set object speed 34,100
rem walk animation
if animestatedg2#=1 then loop object 34,235,259:set object speed 34,100
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 3 ANIMATIONS *********
Rem *****************************************************************************************
rem idle animation
if animestatedg3#=0 then loop object 35,2522,3000:set object speed 34,100
rem walk animation
if animestatedg3#=1 then loop object 35,235,259:set object speed 34,100
Rem *****************************************************************************************
Rem ******** SECURITY GUARD 4 ANIMATIONS *********
Rem *****************************************************************************************
rem idle animation
if animestatedg4#=0 then loop object 36,2522,3000:set object speed 36,100
rem walk animation
if animestatedg4#=1 then loop object 36,235,259:set object speed 36,100
Rem *****************************************************************************************
Rem ******** PLAYER MOVE *********
Rem *****************************************************************************************
` react to key presses and move the controller
key = 0
if upkey()=1 then move camera 1.5:key=1
if downkey()=1 then move camera -1.5:key=1
if upkey()=1 and keystate(57)=1 then move object 3,1:move camera 1:animestate#=2
if key = 1 then animestate#=1:positioncameratoplyrx():loop music 2
if key = 0 then move object 3, 0.0:positioncameratoplyrx():stop music 2:animestate#=0
if keystate(57)=1 and upkey()=1 then jump1=1
if keystate(57)=1 then jump1=1
if keystate(2)=1 and key = 0 then play sound 2:thumbsup=1
if thumbsup=1 then animestate#=3:timethumbsup=1
if timethumbsup=1 then timer1=timer1+1
if timer1=180 then thumbsup=0: timer1=0:timethumbsup=0
Rem *****************************************************************************************
Rem ******** FUNCTION LOOPS *********
Rem *****************************************************************************************
movePlayer()
camera(num)
handleExtraSpheres(num)
sync
loop
Rem *****************************************************************************************
Rem ******** FUNCTIONS *********
Rem *****************************************************************************************
function positioncameratoplyrx()
x#=object position x(3)
y#=object position y(3)
z#=object position z(3)
a#=object angle y(3)
d#=40.0
h#=55.0
s#=50.0
set camera to follow x#,y#,z#,a#,d#,h#,s#,1
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
oldx# = object position x(3)
oldy# = object position y(3)
oldz# = object position z(3)
endfunction positioncameratoplyrx
Function HyperLink(X,Y,String$)
If MouseX() > X And MouseX() < X + Text Width(String$) And MouseY() > Y And MouseY() < Y + Text Height(String$)
Ink Selected,0
Text X,Y,String$
Click = MouseClick()
Else
Ink Standard,0
Text X,Y,String$
Click = 0
EndIf
EndFunction Click
function handleExtraSpheres(num)
for i=33 to 33+num
rem move all the little spheres towards the player and slide them
oldx# = object position x(i)
oldy# = object position y(i)
oldz# = object position z(i)
x# = object position x(i)
y# = object position y(i)
z# = object position z(i)
rem little spheres collide with all (0)
collide = sc_sphereSlide(0,oldx#,oldy#,oldz#,x#,y#,z#,littleRadius#,i)
if collide>0
position object i,sc_getCollisionSlideX(),sc_getCollisionSlideY(),sc_getCollisionSlideZ()
endif
sc_updateObject i
next i
rem show/hide the extra spheres
if returnkey()=1 and rtimer<timer()
rtimer = timer()+300
hide = 1-hide
if hide = 1
for i=33 to 33+num
hide object i
next i
else
for i=33 to 33+num
show object i
next i
endif
endif
endfunction handleExtraSpheres
function movePlayer()
rem rotate player with mouse
oldx# = object position x(3)
oldy# = object position y(3)
oldz# = object position z(3)
rem apply gravity, and user changes to movement
angy# = object angle y(3)
vx# = 0
vz# = 0
rem if player is jumping or falling then apply 'normal' gravity
rem if not attempt to keep the player stuck to the floor
if vy#=0 and jumptimer=0 then vy# = vy# + 5*gravity# else vy# = vy# + gravity#
if keystate(32)=1 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#)
if keystate(30)=1 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#)
if upkey()=1 then vx# = vx# + 2 * sin(angy#) : vz# = vz# + 2 * cos(angy#)
if downkey()=1 then vx# = vx# + (-2) * sin(angy#) : vz# = vz# + (-2) * cos(angy#)
rem only jump if on ground, and a certain time after last jump
if ground=1
if keystate(57)=1 and jumptimer=0 then vy# = vy# + 3.3 : jumptimer = 20
endif
rem this would be the player's final position without collision
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
rem first handle gravity - seperated from horizontal movement
rem to achieve a more realistic effect
rem Method: simple - cast a sphere vertically down, if it hits the level then
rem position the object there (sticky collision) then move
rem on to horizontal movement
rem more complex - if we were to only use the simple method the player would be
rem allowed to climb almost vertical slopes. Alternative is to
rem get the normalY direction to work out how flat the gorund
rem below the player is, 0-slope# is flatter, slope#-1 is steeper.
rem if it's flat, use sticky collision, if it's steep slide the
rem player down the slope. Changing slope# determines how steep the
rem player can climb. NOTE: this also effects stairs.
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
if collide>0
rem how flat is this ground
ny# = sc_getCollisionNormalY()
if abs(ny#)>slope#
rem FLAT, stick
oldy# = sc_getStaticCollisionY()
else
rem STEEP, slide
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
endif
rem ny#<0 means the player has hit a ceiling rather than a floor
if ny#>slope#
rem only on ground if standing on flat ground
ground = 1
vy# = 0
else
ground = 0
rem if player has hit a flat ceiling then stop vy# movement
if ny#<-slope# then vy# = gravity#
endif
else
rem nothing below player, not on ground, add vertical speed to player
oldy# = oldy# + vy#
ground = 0
endif
rem jumptimer will decrease only when player is back on ground
rem creates a pause between two successive jumps
if ground = 1 and jumptimer>0 then dec jumptimer
rem handle horizontal movement as sliding
rem player only collides with group 1 (level) objs and moves freely through others
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
if collide>0
rem if hit, reposition player, halt movement vector
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
rem possible code for giving the player a jumping help up stairs...
rem might be useful if slope# is set very high but stairs are still required
`dy# = oldy#-sc_getStaticCollisionY()
`if dy#<slope# and dy#>0 and ground=1 then vy# = 0.5
endif
rem position the player
position object 3,x#,oldy#,z#
sc_updateObject 3
endfunction movePlayer
function camera(num)
oldx# = camera position x(0)
oldy# = camera position y(0)
oldz# = camera position z(0)
move camera 0,-0.2
x# = camera position x(0)
y# = camera position y(0)
z# = camera position z(0)
collide = sc_sphereSlide(1,oldx#,oldy#,oldz#,x#,y#,z#,littleRadius#,0)
if collide>0
position camera 0,sc_getCollisionSlideX(),sc_getCollisionSlideY(),sc_getCollisionSlideZ()
endif
endfunction camera
SaveGame()
wait key
` Always put an end before the first function
end
FUNCTION SaveGame()
IF FILE EXIST ("SaveGame.dat") = 1 THEN DELETE FILE "SaveGame.dat"
OPEN TO WRITE 1, "SaveGame.dat"
Write Word 1,XPos#
Write Word 1,YPos#
Write Word 1,ZPos#
Write Word 1,XAng#
Write Word 1,YAng#
Write Word 1,ZAng#
Write Word 1,XSize#
Write Word 1,YSize#
Write Word 1,ZSize#
CLOSE FILE 1
CENTER TEXT 500, 160, "Save Succesfull! Press enter key to continue."
ENDFUNCTION SaveGame
FUNCTION loadGame()
open to read 1,"SaveGame.dat"
Read Float 1, XPos#
Read Float 1, YPos#
Read Float 1, ZPos#
Read Float 1, XAng#
Read Float 1, YAng#
Read Float 1, ZAng#
Read Float 1, XSize#
Read Float 1, YSize#
Read Float 1, ZSize#
Close File 1
position object 3, XPos#, YPos#, ZPos#
rotate object 3, XAng#, YAng#, ZAng#
endfunction