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 change then revert...

Author
Message
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 28th Aug 2010 07:50 Edited at: 28th Aug 2010 17:31
Hi All,

If I am keeping my speed within a bracket(spdbrkt) like this:


When I turn(keystate 30 or 32) I want to change my bracket(spdbrkt) to 5 then after turning I want it to go back to whatever (spdbrkt) it was before the turn.
I've been working on this for 2 days and have tried many things, just can't seem to get my head around it.

Mike

some cool stuff someone else said here
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 28th Aug 2010 10:26
this perhaps (not tested):


and



but I'm not sure what you're trying to achieve
cheers
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 28th Aug 2010 19:21
No tried that method myself.
No go.

Mike

some cool stuff someone else said here
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Aug 2010 19:52 Edited at: 28th Aug 2010 20:07
You just need a variable to store the old speed (like Scorpyo posted) and an on/off switch. When you turn the character you save the old speed and turn on the switch. Right before it checks for KEYSTATE(30) and KEYSTATE(32) it checks to see if the switch is on, resets it back to the old speed, and turns off the switch. If the player is still hitting the turn keys it'll repeat the process so it'll always keep the same old speed till the user lets go of the key.

Replace the two lines for turning with this:


Edit: I started this as untested code but decided to test it out anyway. I noticed that the way I had it at first (without "and Turning=0" on the check for the D key) it would make OldSpd equal 5 if the A key was also pressed... which I'm sure you didn't want to happen so I added the check for Turning at zero.

Login to post a reply

Server time is: 2024-11-24 11:52:23
Your offset time is: 2024-11-24 11:52:23