Page 1 of 1

Turning actor. How to use angle?

PostPosted: Wed Jul 30, 2014 11:04 pm
by xenidius93
I want to make turning actor. It should be in Draw Actor > Script Editor, but how to do this?

Re: Turning actor. How to use angle?

PostPosted: Thu Jul 31, 2014 1:54 pm
by bat78
What do you mean by "turning actor" ?
Moving in circle? Thats what i can understand from the diagram.
In that case you could simply use patches.

angle is actor variable that sets the direction (in angles) of the directional_velocity variable, which is used to accelerate the actor.
Code: Select all
angle = 90;
directional_velocity = 5; // accelerate with 5f/fps
//angle = 270 sets the direction to down
//angle = 180 sets the direction to left
//angle = 90 sets the direction to up
//angle = 0 sets the direction to right


If you want your actor to make perfect circles you can use that simple code in draw actor:
Code: Select all
angle += 5;
directional_velocity = 2;

That happans because directional_velocity resets the direction if angle overflow 360. So if angle is 361 then directional_velocity will accelerate your actor at angle 0.

If you want your actor to move like an atom you can do:
Code: Select all
angle += 5 + tan(angle);
directional_velocity = 5;

Re: Turning actor. How to use angle?

PostPosted: Thu Jul 31, 2014 3:39 pm
by lcl
I'm pretty sure he meant rotating the actor.

As an answer for that, sadly you can't do that just by code as it stands. You'll have to make an animation of the sprite rotating 360 degrees. You can make the animation have 8, 16, 32, etc. amount of different angles, it depends on how precise you want the rotation to be. There are tools that can rotate the image for you, if you don't feel like using an image manipulation program to create the different angle frames.

Re: Turning actor. How to use angle?

PostPosted: Thu Jul 31, 2014 4:10 pm
by bat78
lcl wrote:I'm pretty sure he meant rotating the actor.

As an answer for that, sadly you can't do that just by code as it stands. You'll have to make an animation of the sprite rotating 360 degrees. You can make the animation have 8, 16, 32, etc. amount of different angles, it depends on how precise you want the rotation to be. There are tools that can rotate the image for you, if you don't feel like using an image manipulation program to create the different angle frames.


Hey dear friend.

If he meant rotating, then he could try gE1.4.2b.. because it contains rotation.
Despite that.. he can just use GIMP. It has animation property and he can animate spinning for exactly 5 seconds. He just set up GIMP to animate and he just visualize the rotation with the cursor using the rotation tool.

Re: Turning actor. How to use angle?

PostPosted: Fri Aug 01, 2014 2:29 am
by Zivouhr
xenidius93 wrote:I want to make turning actor. It should be in Draw Actor > Script Editor, but how to do this?


There is a demo of a go cart on this forum somewhere (I forget where I found it, probably in Demos or Game Development) and it has a little tiny computer animated GoCart, and it rotates 360 degrees by using the little controller onscreen in the lower left corner. At the very least, it will give you a good idea of how to get something like this to work in Game Editor by examining the Demo and looking at what makes it tick.

Re: Turning actor. How to use angle?

PostPosted: Fri Aug 01, 2014 2:14 pm
by bat78
Oh ..one more thing. When my project come out... you'll be able to rotate images inside gE, export them and then import them back transformed. In the worst case it will lag because of the pre-rendering. But small photos won't be a problem.

Re: Turning actor. How to use angle?

PostPosted: Sat Aug 02, 2014 5:20 am
by xenidius93
Okay. Thanks for reply :)