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 Discussion / fps jumping problem

Author
Message
Flames DB
21
Years of Service
User Offline
Joined: 10th Dec 2002
Location:
Posted: 10th Dec 2002 13:03
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

`standard initialisation
autocam off
sync on
sync rate 60
hide mouse
sync

load image "creep02.bmp",1

backdrop on
color backdrop rgb(255,255,25)

make object box 100,10,50,10
color object 100,rgb(50,50,50)
scale object 100,50,50,200
xrotate object 100,90:fix object pivot 100
position object 100,camera position x()+0,camera position y()-20,camera position z()+30
yrotate object 100,wrapvalue(camera angle y())
lock object on 100

`make the bullet
make object sphere 2,5
color object 2,rgb(145,145,145)
hide object 2


height=100

gosub make_world


do

gosub controls
oldx#=x#
oldz#=z#

gosub camera
gosub weapons

y#=get ground height(1,x#,z#)
position camera x#,y#+height,z#

gosub crosshair

sync
loop

camera:
camx#=camera position x()
camy#=camera position y()-20
camz#=camera position z()
return

weapons:
if mouseclick()=1 and fired=0
print "fired"
position object 2, camx#,camy#,camz#
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:
`mouselook commands
dx#=dx#+mousemovey()/4
cy#=wrapvalue(cy#+mousemovex()/4)
if dx#>90 then dx#=90
if dx#
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 10th Dec 2002 13:59
What I would do, is make a small ball for a character, but have it on the ground so the camera never sees it. Then have your camera move how the object moves, like if the object moves up, then move the camera up.

Thats how Id do it,
RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
Upcoming- MMOFPS- Paintball Game: HELP WANTED!
Http://halbrosproductions.netfirms.com

Login to post a reply

Server time is: 2024-04-26 04:30:58
Your offset time is: 2024-04-26 04:30:58