Help with rotational movement animation
Posted: Mon Apr 30, 2007 9:15 pm
Wonder if anyone can help:- I've got 2 actors, player and enemy. As the (user-controlled) player moves around the screen, the enemy follows and heads towards him, with the enemy having the following DRAW ACTOR action:-
angle=direction(x, y, player.x, player.y);
directional_velocity=2.5;
This works fine movement-wise.
However, the enemy has 36 animation frames (one for every 10 degrees of rotation), the idea being that as the enemy turns and moves towards the player, the animation changes to reflect this. This is the part that I can't seem to get right. I've currently got, under the same DRAW ACTOR action:-
animpos = (angle / 10);
which only seems to work for certain animations (those where the direction is directly left or right of the player)
Anyone know of a better or different way to do this?
Many thanks
angle=direction(x, y, player.x, player.y);
directional_velocity=2.5;
This works fine movement-wise.
However, the enemy has 36 animation frames (one for every 10 degrees of rotation), the idea being that as the enemy turns and moves towards the player, the animation changes to reflect this. This is the part that I can't seem to get right. I've currently got, under the same DRAW ACTOR action:-
animpos = (angle / 10);
which only seems to work for certain animations (those where the direction is directly left or right of the player)
Anyone know of a better or different way to do this?
Many thanks