Turning actor. How to use angle?

Talk about making games.

Turning actor. How to use angle?

Postby xenidius93 » Wed Jul 30, 2014 11:04 pm

I want to make turning actor. It should be in Draw Actor > Script Editor, but how to do this?
Attachments
asteroids.png
asteroids.png (1.7 KiB) Viewed 2349 times
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Re: Turning actor. How to use angle?

Postby bat78 » Thu Jul 31, 2014 1:54 pm

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;
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Turning actor. How to use angle?

Postby lcl » Thu Jul 31, 2014 3:39 pm

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.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Turning actor. How to use angle?

Postby bat78 » Thu Jul 31, 2014 4:10 pm

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.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Turning actor. How to use angle?

Postby Zivouhr » Fri Aug 01, 2014 2:29 am

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.
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score

Re: Turning actor. How to use angle?

Postby bat78 » Fri Aug 01, 2014 2:14 pm

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.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Turning actor. How to use angle?

Postby xenidius93 » Sat Aug 02, 2014 5:20 am

Okay. Thanks for reply :)
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest