How to make an actor rotate to another one?

Game Editor comments and discussion.

How to make an actor rotate to another one?

Postby NevenResnik » Tue Sep 07, 2010 6:43 pm

Is there a way to make an actor rotate to another actor, either by using the angle function, the x,y axis or whatever?

Thanks!
NevenResnik
 
Posts: 42
Joined: Mon May 31, 2010 9:59 am
Score: 0 Give a positive score

Re: How to make an actor rotate to another one?

Postby DilloDude » Wed Sep 08, 2010 2:38 am

To make an actor rotate, you need to do it in the animation. So you pre-rotate the image in your image editor.
Usually about 36 frames works well (10 degrees rotation per frame) although for larger images you'll want more, and for small images you can get away with less.
Then you can use the direction function to find the angle between the two actors, and do a little bit of simple maths to find the correct animation frame. If you want to have a smooth rotation (so it turns over a short time period, rather than instantly), you can use my ReDir function.
Hope that helps, let me know if you have trouble with it.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron