Hello Again , i want to thank you first for all the help you’re giving me guys, i appreciate it a lot. I’ve trying to create lately a Pendulum using FlashPunk, a one that looks a bit realistic like this one created with AS3 :
this is what i did, but is there more efficient way to handle it :
[Embed(source = "../../assets/images/trap/pendulum.png"]
protected static const PENDULUMTRAP_ART:Class;
protected var pendulum:MovieClip = new PENDULUMTRAP_ART();
protected var _pendulumTrap:Image
protected var pAngle:Number = 1.57;
protected var pRotate:Number = 45;
public function PendulumTrap(x:Number=0, y:Number=0)
{
this.x = x;
this.y = y;
_pendulumTrap = new Image(PENDULUMTRAP_ART);
layer = 1;
}
override public function update():void
{
trace("rotate "+pRotate);
_pendulumTrap.angle = Math.sin(pAngle) * pRotate;
pRotate += 0.1;
}
override public function added():void
{
graphic = _pendulumTrap;
}
This one is going 360 rotation degree, so it’s not really a pendulum .