Hey there
I’m currently working on my first game and encountered one problem…well, couldn’t find any solution and i think there isnt any but asking doesnt hurt
i animated the tail of my hero, unfortunately i broke the motion tween into a singleframe-animation because of some “altering-issues” :o
it looks like this
The movement is controlled via mouse, i used the following code to-do so:
package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class Player extends MovieClip
{
private const EASING:Number = 0.04;
private var _angle:Number;
public function Player()
{
_angle = 0;
//Add listeners
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
//Calculate distance to mouse
var dx:Number = stage.mouseX - this.x;
var dy:Number = stage.mouseY - this.y;
var distanceSquared:Number = (dx * dx + dy * dy);
if (distanceSquared >= 1) {
x += dx * EASING;
y +=dy*EASING;
}
//rotate Player
_angle=Math.atan2(y-stage.mouseY,x-stage.mouseX);
var degrees:Number = _angle / (Math.PI / 180);
rotation=degrees;
}
}
}
with this, the MC gradually speeds up, reaches its maximum speed and gradually slows down as the distance to the mousecursor decreases
What i’d want is to speed up the “wiggle” in my animation when its moves faster - is there anyway ?
another thing id like to know is, is there a way to bend the Movieclip when it rotates? it looks quite stiff as it is :o
thanks for your help, in advance