yvelocity limit using this code?

Non-platform specific questions.

yvelocity limit using this code?

Postby Hblade » Tue Apr 03, 2012 6:13 am

Hi, I was wondering how I can make this work? I tried only once, but I figured it'd be easier to ask on the forums. If I find it out before anyone answers, I'll delete this post :3

Code: Select all
yvelocity+=1+max(0, min(yvelocity, 10));


but no matter what code I try, he always vanishes in 1 frame DX... I even tried this
Code: Select all
yvelocity+=max(.3, min(.3, .3));


O-o


EDIT:
got him to stop vanishing, but now he stays at a velocity of 10 :P
Code: Select all
    yvelocity+=.3;
    yvelocity=max(10, min(yvelocity, -12));


^^
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: yvelocity limit using this code?

Postby skydereign » Tue Apr 03, 2012 6:43 am

You mean like this?
Code: Select all
yvelocity = max(0, min(yvelocity+1, 10));
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: yvelocity limit using this code?

Postby Hblade » Tue Apr 03, 2012 6:40 pm

Thanks! +1
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron