I am having several problems in my game. One The jumping code doesn't work thats because it starts the camera so it's off the maxtrix and is in the middle of the camera so there is a line and not below the camera and when you jump it will cause you to float in mid air when it comes down then stops. I have just started using dbc so I need a simple fix with out going thought a lot of complex commands.
My second problem is I can include collisions with jumping and I can't even create collisions at all. I need a lot of help in this area. I need the code and a detailed explanation not just the code.
Here is the code:
make matrix 1,100,100,40,40
load object "H-AK47-Static.x",1
scale object 1,300,300,300
xrotate object 1,0
lock object on 1
position object 1,2,-1,2
rem hide mouse
hide mouse
rem set all varibles
x# = 0
z# = 0
make object box 3,10,10,10
position object 3,100,0,100
make object box 4,10,10,10
position object 4,30,0,30
make object box 5,10,10,10
position object 5,50,0,50
rem set collision varibles
camerax# = camera position x()
cameray# = camera position y()
cameraz# = camera position z()
make object box 2,10,10,10
position object 2,camerax#,cameray#,cameraz#
sync on
do
sync
rem loop collision position varibles
camerax# = camera position x()
cameray# = camera position y()
cameraz# = camera position z()
rem update varibles for mouse movement
camx# = wrapvalue(camx#+(mousemovey()*0.23))
camy# = wrapvalue(camy#+(mousemovex()*0.23))
camz# = wrapvalue(camz#+(mousemovez()*0.23))
rem limit the rotation
if camx# <70 and camx# > 180 then camx# = 290
if camx# >70 and camx# <180 then camx#=70
rem update camera angles
rotate camera 0,camy#,camz#
rem here's the jump
if spacekey()=1 and jump=0
jump = 1
force# = 5.0
endif
if jump=1
y#=y#+force#
force# = force# - 0.5
if force# = -5 then jump = 0
endif
position camera camerax#,y#,cameraz#
rem camera_movement
if upkey() = 1 then move camera 0.5
if downkey() = 1 then move camera -0.5
xrotate camera camx#
loop
Here's the code that can be tested:
make matrix 1,100,100,40,40
rem hide mouse
hide mouse
rem set all varibles
x# = 0
z# = 0
make object box 3,10,10,10
position object 3,100,0,100
make object box 4,10,10,10
position object 4,30,0,30
make object box 5,10,10,10
position object 5,50,0,50
rem set collision varibles
camerax# = camera position x()
cameray# = camera position y()
cameraz# = camera position z()
make object box 2,10,10,10
position object 2,camerax#,cameray#,cameraz#
sync on
do
sync
rem loop collision position varibles
camerax# = camera position x()
cameray# = camera position y()
cameraz# = camera position z()
rem update varibles for mouse movement
camx# = wrapvalue(camx#+(mousemovey()*0.23))
camy# = wrapvalue(camy#+(mousemovex()*0.23))
camz# = wrapvalue(camz#+(mousemovez()*0.23))
rem limit the rotation
if camx# <70 and camx# > 180 then camx# = 290
if camx# >70 and camx# <180 then camx#=70
rem update camera angles
rotate camera 0,camy#,camz#
if spacekey()=1 and jump=0
jump = 1
force# = 5.0
endif
if jump=1
y#=y#+force#
force# = force# - 0.5
if force# = -5 then jump = 0
endif
position camera camerax#,y#,cameraz#
rem camera_movement
if upkey() = 1 then move camera 0.5
if downkey() = 1 then move camera -0.5
xrotate camera camx#
loop
Thanx for the help!!!