That is on nasty jumping script , thank you pcRaider worked well.
But of course with something fixed other things goes wrong , seems like mye bullets ain't shooting from the gun anymore .. or some here and there , but stickes to the floor right away.
rem Initial settings
sync rate 100 :sync on
backdrop off : hide mouse
rem Select font
set text font "arial" : set text size 16
set text to bold : set text transparent
rem Loading prompt
sync : center text screen width()/2,screen height()/2,"LOADING" : sync
rem Load all media for game
gosub _load_game
rem Setup all objects for game
gosub _setup_game
rem Game loop
do
rem Control game elements
gosub _control_player
gosub _control_gunandbullet
rem Update screen
sync
rem End loop
loop
rem End program
end
_control_player:
rem Control player direction
rotate camera camera angle x(0)+(mousemovey()/2.0),camera angle y(0)+(mousemovex()/2.0),0
rem Control player movement
cx#=camera angle x(0) : cy#=camera angle y(0)
if upkey()=1 then xrotate camera 0,0 : move camera 0, 0.1 : xrotate camera 0,cx#
if downkey()=1 then xrotate camera 0,0 : move camera 0,-0.1 : xrotate camera 0,cx#
if leftkey()=1 then yrotate camera 0,cy#-90 : move camera 0.1 : yrotate camera 0,cy#
if rightkey()=1 then yrotate camera 0,cy#+90 : move camera 0.1 : yrotate camera 0,cy#
rem jumping =======================================
if jmp=1 then gosub Jump_run
Jump_run:
position camera camera position x(), camera position y()+gg#, camera position z()
gg#=gg#-0.01
`if (init_pos + S#)<0 ` then gosub end_jump
if jmp=1
if int(oy#*1)=int(camera position y()*1)
if gg#<0
end_jump:
jmp=0
time#=0.0
gg#=1.0
endif
endif
endif
oy#=camera position y()
remstart
display:
step#=(60.0/screen fps())
text 0, 0, "Welcome to mordi sitt game "+str$(screen fps())
text 0,20, "oy#:"+str$(oy#)+" y:"+str$(camera position y())
text 0,40, "time#"+str$(time#)+" step#"+str$(step#)
text 0,80, " "
text 0,100, "jmp"+str$(jmp)+" gg#"+str$(gg#)
`return
remend
if controlkey()=1 and jmp=0 then jmp=1 : init_pos=camera position y()
rem end jumping ======================================
if wrapvalue(camera angle x())>40 and wrapvalue(camera angle x())<180 then xrotate camera 0,40
if wrapvalue(camera angle x())>180 and wrapvalue(camera angle x())<335 then xrotate camera 0,335
rem Apply simple gravity to player
position camera camera position x(),camera position y()-0.2,camera position z()
rem Player is always focal point of sky
position object SkyObj,camera position x(),camera position y(),camera position z()
rem Position listener at player for 3D sound
position listener camera position x(),camera position y(),camera position z()
rotate listener camera angle x(),camera angle y(),camera angle z()
rem In case of restart
if restart=1
restart=0
set bsp collision off 1
rotate camera 0,0,0
position camera 2,2,2
set camera range 0.1,5000
set bsp camera collision 1,0,0.75,0
endif
return
_control_gunandbullet:
rem Control gun firing
if mouseclick()=1 and bullet=-50
bullet=100
play sound GunSnd
position object BulletObj,camera position x(0),camera position y(0),camera position z(0)
rotate object BulletObj,camera angle x(0),camera angle y(0),0
set bsp object collision 2,BulletObj,0.1,1
if particles exist(1)=1 then delete particles 1
make particles 1, FireImg, 50, 0.5
set particle emissions 1,10
set particle speed 1,0.01
move object BulletObj,0.2
endif
rem Control life of bullet
if bullet>0
rem If bullet collides with BSP world
if bsp collision hit(2)=1 or bulletimpact=1
rem End bullet on wall
position sound ImpactSnd,object position x(BulletObj), object position y(BulletObj), object position z(BulletObj)
play sound ImpactSnd
bulletimpact=0
bullet=0
else
rem Move bullet
dec bullet
move object BulletObj,0.5
set particle emissions 1,1+(bullet/10)
endif
rem Update particle using bullet object position
rotate particles 1,90-object angle x(BulletObj),object angle y(BulletObj)+180,0
position particles 1,object position x(BulletObj),object position y(BulletObj),object position z(BulletObj)
rem Bullet dies
if bullet=0
set particle emissions 1,0
set bsp collision off 2
endif
else
rem Gun recharge phase
if bullet>-50 then dec bullet
endif
return
rem If enemy alive
rem if object visible(ene)=1
rem Kill this enemy
rem killenemy=0
rem Switch direction of curve based on a random value
if rnd(200)=1 then zrotate object ene,rnd(1)
rem If enemy and bullet in same space, enemy dies
rem if bullet>0
rem if object collision(BulletObj,ene)>0
rem play sound EnemydieSnd
rem play object ene,26,26+50
rem set object speed ene,100
rem bulletimpact=1
rem endif
rem endif
_setup_game:
rem Setup camera
set camera range 0.1,5000
autocam off
rem Setup sky model
set object SkyObj,1,0,0,0,0,0,0
scale object SkyObj,20,20,20
rem Setup gun for player
lock object on GunObj
scale object GunObj,2,2,4
rotate object GunObj,270,0,0
position object GunObj,0.5,-1,1
disable object zdepth GunObj
rem Create object for bullet
BulletObj=3 : make object cube BulletObj,0.1
rem Create simple sprite based crosshair
sprite 1,320-16,240-16,CrossHairImg
set sprite 1,0,1
rem Start the enemy presence sound
loop sound EnemySnd
scale listener 0.1
rem Trigger player initialisation
restart=1
return
_load_game:
rem Load BSP world and sky model
load bsp "world\ikzdm1.pk3","map.bsp"
rem load bsp "world\ikzdm1.pk3","ikzdm1.bsp"
SkyObj=1 : load object "models\sky\am.x",SkyObj
rem Load model for gun
GunObj=2 : load object "models\gun\gun.x",GunObj
rem Load models for enemies
rem EneObj=11
rem for ene=EneObj to EneObj+4
rem load object "models\enemy\H-Alien Psionic-Idle.x",ene
rem append object "models\enemy\H-Alien Psionic-Die.x", ene, total object frames(ene)+1
rem loop object ene,0,25
rem next ene
rem Load all sounds
GunSnd=1 : load sound "sounds\gun.wav",GunSnd
ImpactSnd=2 : load 3dsound "sounds\impact.wav",ImpactSnd
DieSnd=3 : load sound "sounds\die.wav",DieSnd
EnemySnd=11 : load 3dsound "sounds\enemy.wav",EnemySnd
EnemygunSnd=12 : load 3dsound "sounds\enemygun.wav",EnemygunSnd
EnemydieSnd=13 : load 3dsound "sounds\enemydie.wav",EnemydieSnd
rem Load music (WAV best for looping)
MusicSnd=101 : load sound "sounds\ingame.wav",MusicSnd
loop sound MusicSnd : set sound volume MusicSnd,80
rem Load images
FireImg=1 : load image "images\fire.bmp",FireImg
` CrossHairImg=2 : load image "images\ch.bmp",CrossHairImg
CrossHairImg=2 : load image "images\crosshair.bmp",CrossHairImg
return
rem Enemy position data within level
rem EnemyPosData:
rem data -9.27,9.98,-2.78
And one more thing , would love to know how to edit the variables of how high the jump goes.
Again thank you for your time.