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.

Newcomers DBPro Corner / Speed Control?

Author
Message
Agamemnon
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location: Mars
Posted: 6th Feb 2004 19:04
Hey all .
I was working on the sample cave runner game code provided in the DB help section. I cant figure out how to adjust the speed. I changed what looked to me like the speed but no change.
Thanks.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Feb 2004 00:48
The obvious answer is SYNC RATE, but there may be other factors involved, depending on how it's coded.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Agamemnon
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location: Mars
Posted: 7th Feb 2004 18:53 Edited at: 7th Feb 2004 18:55
no that didn't work.
Here is the code i am talking about.

rem ----------------
rem Cave Runner Demo
rem ----------------
rem Author: DBS-LB99
hide mouse

rem Load bitmaps
load bitmap "tiles.bmp",1
get image 1,0,0,256,256
delete bitmap 1

rem Load sound
load sound "hum.wav",1
load sound "explode.wav",2
loop sound 1

rem Load music track
load music "caverun.mid",1
loop music 1

rem Activate manual sync
sync on

rem Make landscape and ceiling matrix
make matrix 1,2000,5000,10,25
prepare matrix texture 1,1,2,2
make matrix 2,2000,5000,10,25
prepare matrix texture 2,1,2,2
fill matrix 2,0,2
randomize matrix 2,350.0
for t=0 to 25
set matrix height 2,0,t,-100
set matrix height 2,10,t,-100
next t
update matrix 2

rem Bagin game loop
do

rem Set seed for same random numbers
randomize 1

rem Clear cave floor
fill matrix 1,0,1

rem Set lighting, fog and setupset ambient light 20
color backdrop 0
if fog available()=1 then fog on : fog color 0 : fog distance 3000

rem Reset speed
x=0
z=0
speed#=0.0

rem Begin main loop
repeat

rem Record old variables
oldx=x
oldgy#=gy#

rem Control key movements
if upkey()=1 then speed#=speed#+1.0 else speed#=speed#-1.0
if leftkey()=1 then rz#=rz#+1.0
if rightkey()=1 then rz#=rz#-1.0

rem Control variables
if speed#<0.0 then speed#=0.0
if speed#<10.0 then speed#=speed#+1.1
if speed#>40.0 then speed#=40.0
rz#=rz#/1.1
x=x-(2*rz#)

rem Scroll landscape
z=z+speed#
if z>200
z=z-200
if rnd(3)=0
mp=mp-1
mp=mp+rnd(3)
if mp<1 then mp=1
if mp>4 then mp=4
endif
for t=0 to 0 : set matrix height 1,t,24,450 : set matrix tile 1,t,24,2 : next t
for t=1 to mp : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,2 : next t
for t=mp+1 to mp+1 : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,3 : next t
for t=mp+2 to mp+3 : set matrix height 1,t,24,rnd(20) : set matrix tile 1,t,24,1 : next t
for t=mp+4 to mp+4 : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,4 : next t
for t=mp+5 to 9 : set matrix height 1,t,24,rnd(200) : set matrix tile 1,t,24,2 : next t
for t=10 to 10 : set matrix height 1,t,24,450 : next t
update matrix 1
shift matrix up 1
shift matrix up 2
endif

rem Position matrix
position matrix 1,0,0,2500-z
position matrix 2,0,100,2500-z

rem Position camera
gy#=curvevalue(50+get ground height(1,500+x,z),gy#,3)
position camera 500+x,gy#,2500
zrotate camera wrapvalue(rz#)

rem Control sound frequency
set sound speed 1,10000+(speed#*100)

rem Update screen
sync

rem End main loop when collision with ceiling
until get ground height(2,500+x,z)<gy#-75.0

rem Return camera to point before collision
position camera 500+oldx,oldgy#,2500

rem Game Over
play sound 2
for c=0 to 255 step 20
cls rgb(c,0,0)
if fog available()=1 then fog distance (c*5) : fog color (c*256*256)
sync
next c

rem End game loop
loop
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 7th Feb 2004 21:10
if speed#>40.0 then speed#=40.0

that line limits your top speed, change the 40 to 4000 for example and you can go at warp speed (and die realy fast)

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
Agamemnon
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location: Mars
Posted: 8th Feb 2004 03:05 Edited at: 8th Feb 2004 03:16
Thanks,
Another thing i was wondering about.
I dont understand how the rem Scroll landscape section works. I now what its responsible for but i am getting confused with the code.


PS: Also how would i create a more obstacle filled floor, making it harder to get through?

Login to post a reply

Server time is: 2024-09-21 20:55:12
Your offset time is: 2024-09-21 20:55:12