topical media & game development
#physic-flex-ape-sample-car-SwingDoor.ax
(swf
)
[ flash
]
flex
package {
import org.cove.ape.*;
public class @ax-physic-flex-ape-sample-car-SwingDoor extends Group {
public function @ax-physic-flex-ape-sample-car-SwingDoor(colE:uint) {
// setting collideInternal allows the arm to hit the hidden stoppers.
// you could also make the stoppers its own group and tell it to collide
// with the @ax-physic-flex-ape-sample-car-SwingDoor
collideInternal = true;
var swingDoorP1:CircleParticle = new CircleParticle(543,55,7);
swingDoorP1.mass = 0.001;
swingDoorP1.setStyle(1, colE, 1, colE);
addParticle(swingDoorP1);
var swingDoorP2:CircleParticle = new CircleParticle(620,55,7,true);
swingDoorP2.setStyle(1, colE, 1, colE);
addParticle(swingDoorP2);
var swingDoor:SpringConstraint = new SpringConstraint(swingDoorP1, swingDoorP2, 1, true, 13);
swingDoor.setStyle(2, colE, 1, colE);
addConstraint(swingDoor);
var swingDoorAnchor:CircleParticle = new CircleParticle(543,5,2,true);
swingDoorAnchor.visible = false;
swingDoorAnchor.collidable = false;
addParticle(swingDoorAnchor);
var swingDoorSpring:SpringConstraint = new SpringConstraint(swingDoorP1, swingDoorAnchor, 0.02);
swingDoorSpring.restLength = 40;
swingDoorSpring.visible = false;
addConstraint(swingDoorSpring);
var stopperA:CircleParticle = new CircleParticle(550,-60,70,true);
stopperA.visible = false;
addParticle(stopperA);
var stopperB:RectangleParticle = new RectangleParticle(650,130,42,70,0,true);
stopperB.visible = false;
addParticle(stopperB);
}
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.