ok... indi... this is what my code is with your code... kind of long... but yea... the game doesn't freeze when i hit pause:
hide mouse
sync rate 60
`INTRODUCTION/MENU
`INTRODUCTION/MENU
`INTRODUCTION/MENU
load bitmap "HPproductions Presents.bmp",0
wait 5000
load bitmap "Logo.bmp",0
wait 5000
CLS
disable escapekey
load image "menu.bmp",1
load image "Play.bmp",2
load image "Instructions.bmp",3
load image "Exit.bmp",4
set text font "Times New Roman"
set text size 16
_menu:
paste image 1,45,50
paste image 2,260,100,1
Paste image 3,160,200,1
Paste image 4,260,300,1
Text 0,0,"Press 'P' to Play, 'I' to read through the instructions, or 'E' to quit."
do
if keystate(25)=1 then CLS : gosub _Game
if keystate(23)=1 then CLS : Text 0,0,"Player 1- Press the Up and Down Arrow keys to move." : Text 0,20,"Player 2- Press the W and S keys to move up and down" : Text 0,400,"Press the L key to go back."
if keystate(18)=1 then end
if keystate(38)=1 then CLS : paste image 1,45,50 : paste image 2,260,100,1 : Paste image 3,160,200,1 : Paste image 4,260,300,1 : Text 0,0,"Press 'P' to Play, 'I' to read through the instructions, or 'E' to quit."
loop
`INTRODUCTION/MENU
`INTRODUCTION/MENU
`INTRODUCTION/MENU
`GAME
`GAME
`GAME
_Game:
sleep 1000
`the start...
autocam off
sync rate 120
sync on
`variables
PAUSEGAME_TOGGLE=0
PAUSEGAME_SWITCH=0
`make a player object
gosub _player
`make a simple level
gosub _level1
rem Main loop
disable escapekey : while escapekey()=0
`pause
If keystate(25)=1 and PAUSEGAME_SWITCH=0
PAUSEGAME_TOGGLE=1-PAUSEGAME_TOGGLE
PAUSEGAME_SWITCH=1
Endif
If keystate(25)=0 then PAUSEGAME_SWITCH=0
if PAUSEGAME_TOGGLE=1
PAUSEGAME()
endif
`movement
if upkey()=1 then move object 1,0.8
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-2.5)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+2.5)
if spacekey()=1 and playergrav#=0.0 then playergrav#=2.0
rem Use camera tracker to follow player object
`change these parameters for other camera positions
angle#=object angle y(1)
camdist#=25.0 : camhigh#=posy#+8.0 : camfade#=3.5
set camera to follow posx#,posy#,posz#,angle#,camdist#,camhigh#,camfade#,1
`player position
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)
`camera position
cposx#=camera position x()
cposy#=camera position y()
cposz#=camera position z()
position object 2,cposx#,cposy#,cposz#
rem Handle a touch of gravity
playergrav#=playergrav#-0.1
posy#=posy#+playergrav#
rem Handle sliding collision for player object with other objects
position object 1,posx#,posy#,posz#
if object collision(1,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
if get object collision y()<0 then playergrav#=0.0
endif
`move one of the platforms and update the players position if he hits it
`for smooth movement i use a sinus
a=wrapvalue(a+1)
position object 508,object position x(508)+sin(a),-5,200
if object collision(1,508)=1 then posx#=posx#+sin(a)
position object 509,object position x(509)-sin(a),-5,200
if object collision(1,509)=1 then posx#=posx#-sin(a)
rem camera collision
if object collision(2,0)>0
dec cposx#,get object collision x()
dec cposy#,get object collision y()
dec cposz#,get object collision z()
endif
position object 2,cposx#,cposy#,cposz#
position camera cposx#,cposy#,cposz#
rem Update with new object position
position object 1,posx#,posy#,posz#
rem Tilt camera down a little
xrotate camera 15
rem Update screen
sync
rem End loop
Endwhile
`Pause Function
Function PAUSEGAME()
center text screen width()/2,screen height()/2,"paused"
endfunction
`makes the player
_player:
make object box 1,10,10,10
color object 1,rgb(0,0,255)
position object 1,0,0,0
make object collision box 1,-5,-5,-5,5,5,5,0
`makes the camera
make object cube 2,1
make object collision box 2,-0.5,-0.5,-0.5,0.5,0.5,0.5,0
hide object 2
return
`level 1
_level1:
`the floor
make object box 100,1000,10,1000
position object 100,0,-20,0
color object 100,rgb(10,200,10)
make object collision box 100,-500,-5,-500,500,5,500,0
`some boxes and platforms
make object box 500,10,5,20
position object 500,100,-12.5,350
color object 500,rgb(200,0,0)
make object collision box 500,-5,-2.5,-10,5,2.5,10,0
make object box 501,50,20,20
position object 501,0,-5,350
color object 501,rgb(200,0,0)
make object collision box 501,-25,-10,-10,25,10,10,0
for t=502 to 507
make object box t,20,5,20
position object t,-100+(t-502)*35,-5+(t-502)*3,100
color object t,rgb(rnd(255),rnd(255),rnd(255))
make object collision box t,-10,-2.5,-10,10,2.5,10,0
next t
`these will be the moving platforms
make object box 508,20,5,20
position object 508,-130,-5,200
color object 508,rgb(rnd(255),rnd(255),rnd(255))
make object collision box 508,-10,-2.5,-10,10,2.5,10,0
make object box 509,20,5,20
position object 509,130,-5,200
color object 509,rgb(rnd(255),rnd(255),rnd(255))
make object collision box 509,-10,-2.5,-10,10,2.5,10,0
`and walls around the scene
for t=0 to 1
make object box t+512,10,40,500
position object t+512,-200+t*400,5,220
color object t+512,rgb(rnd(255),rnd(255),rnd(255))
make object collision box t+512,-5,-20,-250,5,20,250,0
make object box t+514,400,40,10
position object t+514,0,5,-30+t*500
color object t+514,rgb(rnd(255),rnd(255),rnd(255))
make object collision box t+514,-200,-20,-5,200,20,5,0
next t
return
srry if there are mistakes... or i didn't do things shorter... but there it is... plz help
THANKS FOR STOPING AT A RED LIGHT... AND LETTING ME CRASH INTO YOU AT 80 MILES AN HOUR!!!