Damaged Plane Animation

  ... questions about tools around the development with AndEngine.

Damaged Plane Animation

Postby fanatic » Wed Feb 01, 2012 12:02 pm

Hi Guys,

I have created a damaged plane flying animation. I have done with the help of modifiers like this:

PhysicsHandler ph = new PhysicsHandler(face);
ph.setVelocityX(100);

float time = 1f;
float d = 60f;
float angle = 5f;

MoveYModifier m1 = new MoveYModifier(time*0.8f, face.getY(), face.getY()+d);
DelayModifier dm1 = new DelayModifier(time*0.2f);
MoveYModifier m2 = new MoveYModifier(time*0.8f, face.getY()+d, face.getY());
DelayModifier dm2 = new DelayModifier(time*0.2f);

RotationModifier r1 = new RotationModifier(0.4f, 0, angle);
DelayModifier rd1 = new DelayModifier(0.2f);
RotationModifier r2 = new RotationModifier(0.4f, angle, 0);
RotationModifier r3 = new RotationModifier(0.4f, 0, -angle);
DelayModifier rd2 = new DelayModifier(0.2f);
RotationModifier r4 = new RotationModifier(0.4f, -angle, 0);

SequenceEntityModifier rotateSeq = new SequenceEntityModifier(r1,rd1,r2,r3,rd2,r4);
SequenceEntityModifier moveSeq = new SequenceEntityModifier(m1,dm1,m2,dm2);

ParallelEntityModifier pm = new ParallelEntityModifier(moveSeq,rotateSeq);

face.registerUpdateHandler(ph);
face.registerEntityModifier(new LoopEntityModifier(pm));

scene.getLastChild().attachChild(face);

I know its complicated. But the idea of the code is to give it a sinusoidal movement depicting slight rotation as well. Is there a better way to do it. Please help! :)

-Fanatic
fanatic
 
Posts: 27
Joined: Mon Aug 16, 2010 4:22 am

Return to Tools

Who is online

Users browsing this forum: No registered users and 3 guests