Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / fps jumping problem

Author
Message
Flames DB
21
Years of Service
User Offline
Joined: 10th Dec 2002
Location:
Posted: 10th Dec 2002 12:59
hi there db programmers, im a bit of a newbie and wondered if anyone could tell me how to make the camera move to look like it has jumped, eg if spacekey()=1 then .....

i would be grateful for any help, i have posted my code, so you can see the commands.
thanx

Set object to camera orientation 2
fired=25
Show object 2
endif

If fired > 0
Dec fired
Move object 2,20
If fired = 0 then Hide object 2
Endif

return

crosshair:

ink rgb(255,0,0),0
line 320,230,320,250
line 310,240,330,240
circle 320,240,7
set cursor 1,1
print screen fps()
return

controls:

dx#=dx#+mousemovey()/4
cy#=wrapvalue(cy#+mousemovex()/4)
if dx#>90 then dx#=90
if dx#
Dr OcCuLt
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: a Dark Deep Dark pit, it dark in here
Posted: 10th Dec 2002 15:27
try setup up a Variable DY# to then applying gravtey to it eg

rem jump
if SPACEKEY()=1 then DY#=10

rem applying gravtey
DY#=DY#-0.5

rem POSITION CAMERA
POSITION CAMERA CAMERA POSITION X(),CAMERA POSITION Y()+DY#,CAMERA POSITION Z()

rem floor when y<0 => y=0
if CAMERA POSITION Y()<=0
DY#=0
POSITION CAMERA CAMERA POSITION X(),0,CAMERA POSITION Z()
endif

you must set up a commands to be a floor or you camer will not stop drop
Kangaroo2
21
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 10th Dec 2002 16:19
Where you have "camy#=camera position y()-20"
You could just replace it with

camy#=camera position y()-20+jump
if spacekey()=1 and jump$="no" then jump$="up"
if jump$="up" then jump=jump+1
if jump>40 then jump$="down"
if jump$="down" then jump=jump-1
if jump<1:jump=0:jump$="no":endif

This is probably the simplest way for a newbie

Obviously the 40 is the maximum jump height to add to your standard height, and the 1 is the jump speed. You can edit these to whatever you like, integer wise to change the effect.

Good luck in your project

* If the apocalypse comes, email me *
Kangaroo2
21
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 10th Dec 2002 16:21
oops sorry you should add

jump$="no"

right at the beginning of your program, not included in your do/loop obviously

Hope this helps

* If the apocalypse comes, email me *

Login to post a reply

Server time is: 2024-05-07 22:37:10
Your offset time is: 2024-05-07 22:37:10