how do you make rotation?

Game Editor comments and discussion.

how do you make rotation?

Postby Fojam » Tue Mar 31, 2009 9:40 pm

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? :mrgreen:
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: how do you make rotation?

Postby jimmynewguy » Tue Mar 31, 2009 10:34 pm

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 :D
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: how do you make rotation?

Postby Fojam » Tue Mar 31, 2009 11:07 pm

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?
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: how do you make rotation?

Postby DST » Wed Apr 01, 2009 1:28 am

angle+=180;
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: how do you make rotation?

Postby Fojam » Wed Apr 01, 2009 7:52 pm

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
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: how do you make rotation?

Postby jimmynewguy » Fri Apr 03, 2009 1:40 pm

if(directional_velocity >= 0)
{
directional_velocity -= anumberyoupick;
}
else if(directional_velocity <= 0)
{
directional_velocity = 0;
}
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: how do you make rotation?

Postby Fojam » Tue Apr 07, 2009 8:48 pm

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?
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: how do you make rotation?

Postby futuro » Mon Apr 20, 2009 1:48 pm

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
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score

Re: how do you make rotation?

Postby DST » Mon Apr 20, 2009 6:25 pm

directional_velocity=-10;

will also make actor move backwards
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: how do you make rotation?

Postby futuro » Wed Apr 22, 2009 12:10 pm

another more...

How rotate a sprite? or actor
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score

Re: how do you make rotation?

Postby futuro » Thu Apr 23, 2009 5:53 pm

then, if I create a game with a car on turn left or rigth?? ?????????????????????
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score

Re: how do you make rotation?

Postby Fojam » Thu Apr 23, 2009 6:59 pm

ok! thanks so much! I was like trying to make this minigame with a remote control car, so now I can work on it. :D
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: how do you make rotation?

Postby futuro » Sun May 03, 2009 7:18 pm

then, if I want rotate a car, I must change the animation and change directional_velocity + angle ¿Not?
It's so complicated ¿not?
alguien que hable mi idioma ÑñÑñÑñ
User avatar
futuro
 
Posts: 37
Joined: Mon Apr 13, 2009 1:22 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron