Hi all,
I'm very inexperienced with DBPro and I'm trying to make a basic FPS.
Problem#1 (Collisions):
Ok I'm trying to get basic collisions in my game, I have a level and a gun (I will use a sphere for my player later on) and I'm failing. This is ALL the code I have for collisions.. Do I need to put something in my main loop?
Here is my code:
`Load Level
lvl=9999 : Load object "media\level_01\lvl1.3ds", lvl
SC_SetupObject lvl,1,0
SC_SetObjectCollisionOn lvl
`Objects
M4=1 : Load object "Media\objects\m4.3ds",M4
SC_SetupObject m4,1,1
SC_SetObjectCollisionOn m4
Problem#2 (Movement):
OK I have basic movement down (Thanks to the code on this website). But I have a slight problem, when I strafe left and move forward at the same time it doubles my speed... I don't have any Idea how to stop this any idea's?
Here is my code:
`center mouse
position mouse 320,240
x# = camera position x()
y# = camera position y()
z# = camera position z()
`forwards (w)
if keystate(17)=1
x# = newxvalue(x#,wrapvalue(camera angle y()),.25)
z# = newzvalue(z#,wrapvalue(camera angle y()),.25)
endif
`backwards (s)
if keystate(31)=1
x# = newxvalue(x#,wrapvalue(camera angle y()-180),.25)
z# = newzvalue(z#,wrapvalue(camera angle y()-180),.25)
endif
`left (a)
if keystate(30)=1
x# = newxvalue(x#,wrapvalue(camera angle y()-90),.25)
z# = newzvalue(z#,wrapvalue(camera angle y()-90),.25)
endif
`right (d)
if keystate(32)=1
x# = newxvalue(x#,wrapvalue(camera angle y()+90),.25)
z# = newzvalue(z#,wrapvalue(camera angle y()+90),.25)
endif
`camera rotation
yrotate camera camera angle y() + mousemovex()*0.3
xrotate camera camera angle x() + mousemovey()*0.3
`stops mouse from going upside down
if wrapvalue(camera angle x(0))>70 and wrapvalue(camera angle x(0))<180 then xrotate camera 0,70
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280
`camera position
position camera x#,y#,z#
Thanks for any help!
ProphetHill