The starting Player position no mater what i try seems to stay out side of the level.. I would like to fix this, anyone spot why this is happeneing?
cls
set display mode 1280,1024,32
set window off
maximize window
hide mouse
makelevel()
makeplayer()
global Ammo = 6
global spareammo = 24
set text size 30
set dir ".."
Load sound "music/gunsingleshot.wav",200
set sound volume 200,100
load sound "music/gunreload.wav",201
set sound volume 201,100
do
moveplayer()
sync
LOOP
function makelevel()
set dir "files"
load static objects "levelbank/testlevel/universe.dbo",0
load object "levelbank/testlevel/universe.dbo",1 :hide object 1
fog color rgb(28,28,0)
color backdrop rgb(28,28,28)
sc_setupobject 1,0,0
endfunction
function makeplayer()
make object sphere 2,100 : rem hide object 2
position object 2,700,50,-600
sc_setupobject 2,0,2
endfunction
function moveplayer()
rem bullet
Make object sphere 10,3
load image "textures/gold.bmp",40
Texture object 10,40
Hide object 10
rem gun
load object "media/python.x",100
load image "media/Elite_tex.dds",50
texture object 100,50
YRotate Object 100,180
Fix object pivot 100
Scale object 100,125,75,100
position object 100,0,-10,15
Lock object on 100
do
oldx#=object position x (2)
oldy#=object position y (2)
oldz#=object position z (2)
`camera rotate positions
oldx#=camera angle x()
oldy#=camera angle y()
oldz#=camera angle z()
`mouse position
mx# = mousemovex()
my# = mousemovey()
oldx# = wrapvalue(oldx# + my#) : xrotate camera oldx#
oldz# = wrapvalue(oldz# + my#) : zrotate camera oldz#
if upkey()
x# = newxvalue(x#,oldy#,4.0)
z# = newzvalue(z#,oldy#,4.0)
position object 2,x#,y#,z#
endif
if downkey()
x# = newxvalue(x#,oldy#,-2.0)
z# = newzvalue(z#,oldy#,-2.0)
position object 2,x#,y#,z#
endif
Position Camera object position x(2),object position y(2),object position z(2)
sc_updateobject 2
`360 camera movement
rotate camera oldx#+((my#+0.0)/10.0),oldy#+((mx#+0.0)/10.0),0
if sc_spherecast(0,oldx#,oldy#,oldz#,object position x(2),object position y(2),object position z(2),object size(2),2)>0
position object 2,sc_getstaticcollisionx(),sc_getstaticcollisiony(),sc_getstaticcollisionz()
Position Camera object position x(2),object position y(2),object position z(2)
sc_updateobject 2
endif
if ammo > 0
If mouseclick()=1 and Bulletlife=0
set object to camera orientation 10
Position object 10,X#,Y#+70,Z#
Bulletlife = 100
Show object 10
play sound 200
damage = 25
ammo = ammo - 1
Endif
if bulletlife>0
Dec bulletlife
Move object 10,20
If bulletlife=0 then hide object 10
endif
endif
if spareammo > 1
enterkey = keystate(28)
if enterkey=1
play sound 201
spareammo =spareammo - (6-ammo)
ammo = 6
endif
endif
if ammo = 0
set text size 70
set cursor 550,200
print "RELOAD";
endif
hud()
loop
endfunction
function hud()
set text size 30
set cursor 1000,20
print "Ammo in gun: "; ammo
set cursor 1000,40
print "Ammo(spare): "; spareammo
endfunction
function newammo()
rem ammo1
load object "media/python_ammo.x",101
load image "textures/ammo.bmp",41
texture object 101,41
do
rem bullet
position object 101,1150,30+(cos(a#)*10),-1100
s#=300+(cos(a#)*25)
scale object 101,s#,s#,s#
yrotate object 101,a#
inc a#,2.0
loop
endfunction
Thanks