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 / I have a question about TIMERS

Author
Message
OnQue Int
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 17th Feb 2009 18:11 Edited at: 17th Feb 2009 18:25
I am wanting to know how to create a sliding effect. Like if I was

running and had to duck something instead of crouching and

walking I could slide under it. I would guess I need to use a

timer for this. because I would only slide so far then I want to

go back to my normal height. but it would depend on my momentum on

how far I would slide before returning to original height. How

would I acomplish this? and also if anyone knows I am decreasing

my radius to crouch would this be wrong?
pollywog
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location:
Posted: 18th Feb 2009 23:01
for the timer I think it is something like



for the sliding part I guess you could use

I'm assuming you are positioning your character by some speed variable or velocity variable .
so probably in your code there is something about
mycharacterpositon.x = mycharacterposition.x + xVelocity
mycharacterpostion.y = mycharacterposition.y + yVelocity

so when you are determing your x velocity you could use
v = vo + at (I think thats the equation quite some time since I had physics)
where v is your velocity
vo is your inital velocity
a is your acceleration
t is time (defined previously by your timer)

so most of the time your acceleration a is going to be 1. but when your sliding your acceleration is going to go into the negative. so your character slows down while your sliding.

just found a site of useful equations for this kind of stuff
http://library.thinkquest.org/15433/unit1/1-3.htm
OnQue Int
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 19th Feb 2009 13:06 Edited at: 19th Feb 2009 14:07
I am not positioning my character like that this is my code





can I do this with this kinda of positioning or will I have to

change everything which I would'nt mind. Also I havent messed with

timers before would you mind explaining more. I thought I

understood, but when I ran it it gave me an error at the end while

comand .

thanks very much POLLYWOG
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 19th Feb 2009 17:27
would this be any easier to use



Dark Physics makes any hot drink go cold.
OnQue Int
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 19th Feb 2009 17:50
Ok great any ideas on the sliding?
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 19th Feb 2009 18:24
if you are using a character model then run an animation from up right to the slide position and move in the direction of the slide while using the timer.

Dark Physics makes any hot drink go cold.
OnQue Int
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 19th Feb 2009 20:30
Ok I get the sliding but for some reason I cant get this

lets say this

IF SHIFTKEY()=1
RADIUS# = RADIUS# -.3
IF RADIUS# < 4
RADIUS# = 4
ENDIF
ENDIF

this is how I am crouching at the moment and the one below is how

I am standing using this way how would I get this to work, maybey I

am just over thinking this. Lets say I wanted to crouch by using

the code above and then delay the return of its original height

for 2 seconds how is that done?

I'm truly sorry for some reason its just not happening thanks for

your help.

IF SHIFTKEY()=0 AND RADIUS# >= 4
RADIUS# = RADIUS# +.3
IF RADIUS# > 8
RADIUS# = 8
ENDIF
ENDIF
OnQue Int
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location:
Posted: 20th Feb 2009 16:03
Mabey I stepped over line somewhere by asking if someone could

show me what I am missing here, because I cant get it to work for

some reason. I am probably missing something really simple.

It seems pretty self explanitory but no luck.



Can someone help me out?

Thanks in advance

Login to post a reply

Server time is: 2024-11-24 13:02:31
Your offset time is: 2024-11-24 13:02:31