Hi all, I'm new with DarkPhysics and I have a problem making a character jump.
This is my code:
set display mode 800,600,32
set window on
sync on
sync rate 60
autocam off
while escapekey()<>1
gosub nivel1
sync
endwhile
end
nivel1:
phy start
make matrix 1,100,10,50,10
position camera 0,10,5,-15
make object box 1,15,1,2
position object 1,7,0,0
phy make rigid body static box 1
make object cube 2,1
position object 2,2,3,0
phy make box character controller 2,2,3,0,0.5,0.5,0.5, 1, 1.5, 45.0
yrotate object 2,90
do
text 10,10,"Fps: " + str$(screen fps())
text 620,25,"PosX: " + str$(object position x(2))
text 620,40,"PosY: " + str$(object position y(2))
text 620,55,"PosZ: " + str$(object position z(2))
phy set character controller displacement 2, 98, 0
phy move character controller 2, 0.1
phy move character controller 2, -0.1
if rightkey()
phy move character controller 2, 2.0
endif
if leftkey()
phy move character controller 2,-2.0
endif
if upkey()
`What we need to put here for character jump.
endif
phy update
sync
loop
return
With right key I move my character forwards and with left key backwards. I would like with up key to jump but I can't get it works. I was looking in the forum but I can't get working even looking other examples :S
Anyone can help me?
Thanks!!