Page 1 of 1
how do you make rotation?

Posted:
Tue Mar 31, 2009 9:40 pm
by Fojam
How do you make a rotation so that when you do something, the actor will rotate one way and when you do something else, the actor will rotate the other way?

Re: how do you make rotation?

Posted:
Tue Mar 31, 2009 10:34 pm
by jimmynewguy
if you have a rotating animation you can change the animation direction to forward/backward to make it go different ways, but there is no code to rotate a sprite

Re: how do you make rotation?

Posted:
Tue Mar 31, 2009 11:07 pm
by Fojam
okay, I figured out how to make a sprite move forward based of the angle of it.
using this code:
- Code: Select all
double newangle = (animpos/nframes)*360;
vectoradd(&angle, &directional_velocity, newangle, 0.5001);
but how do you make it move backwards using this code?
Re: how do you make rotation?

Posted:
Wed Apr 01, 2009 1:28 am
by DST
angle+=180;
Re: how do you make rotation?

Posted:
Wed Apr 01, 2009 7:52 pm
by Fojam
where do I put that?
also, how do you make it stop through the span of two seconds when I lift the key, using this code:
- Code: Select all
directional_velocity = 0;
What I mean is make it slowly stop
Re: how do you make rotation?

Posted:
Fri Apr 03, 2009 1:40 pm
by jimmynewguy
if(directional_velocity >= 0)
{
directional_velocity -= anumberyoupick;
}
else if(directional_velocity <= 0)
{
directional_velocity = 0;
}
Re: how do you make rotation?

Posted:
Tue Apr 07, 2009 8:48 pm
by Fojam
thanks.
Fojam wrote:- Code: Select all
double newangle = (animpos/nframes)*360;
vectoradd(&angle, &directional_velocity, newangle, 0.5001);
but where do I put the
- Code: Select all
angle+=180;
in the above code?
Re: how do you make rotation?

Posted:
Mon Apr 20, 2009 1:48 pm
by futuro
Ok, I think that I understand:
- Code: Select all
angle+=180;
//where that angle is all you want for to move a sprite
directional_velocity = 0;
//where that velocity is of the sprite in another angle
wow... It's too easy one time that you know as...
- Code: Select all
You are understand me? XD
Re: how do you make rotation?

Posted:
Mon Apr 20, 2009 6:25 pm
by DST
directional_velocity=-10;
will also make actor move backwards
Re: how do you make rotation?

Posted:
Wed Apr 22, 2009 12:10 pm
by futuro
another more...
How rotate a sprite? or actor
Re: how do you make rotation?

Posted:
Thu Apr 23, 2009 5:53 pm
by futuro
then, if I create a game with a car on turn left or rigth?? ?????????????????????
Re: how do you make rotation?

Posted:
Thu Apr 23, 2009 6:59 pm
by Fojam
ok! thanks so much! I was like trying to make this minigame with a remote control car, so now I can work on it.

Re: how do you make rotation?

Posted:
Sun May 03, 2009 7:18 pm
by futuro
then, if I want rotate a car, I must change the animation and change directional_velocity + angle ¿Not?
It's so complicated ¿not?