Flash actionscript 3.0: APE Engine
Showing posts with label APE Engine. Show all posts
Showing posts with label APE Engine. Show all posts

Jumping and Movement using APE Engine

0

Posted by Sankar.G | Posted in | Posted on 4:23 PM

Below file is useful to create a Jumping Basement with APE Engine with ball
& useful to Merge the APE particle with Flash MovieClips


APE Jump.fla


APE Jump.swf

How to do the start Drag the APE Objects Dynamically

0

Posted by Sankar.G | Posted in | Posted on 6:44 PM

package
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Sprite;
import org.cove.ape.*;

public class Test extends Sprite
{
private var wp:WheelParticle;
private var array:Array=new Array("");
private var i:Number;
public function Test():void
{
stage.frameRate = 20;
addEventListener(Event.ENTER_FRAME, run);
APEngine.init(2/4);
APEngine.container = this;
var defaultGroup:Group = new Group();
defaultGroup.collideInternal = true;
APEngine.addMasslessForce(new Vector(0,2));

var rp1:RectangleParticle=new RectangleParticle(490,300,200,10,-0.52,true);
defaultGroup.addParticle(rp1);
rp1.setFill(0xff0000);
rp1.setLine(0,0x666666,1);
rp1.sprite.name="rp1";
array.push(rp1);

var rp2:RectangleParticle=new RectangleParticle(430,450,200,10,0,true);
defaultGroup.addParticle(rp2);
rp2.setFill(0xff0000);
rp2.setLine(0,0x666666,1);
rp2.sprite.name="rp2";
array.push(rp2);

var rp3:RectangleParticle = new RectangleParticle(250,300,200,10,0.52,true);
defaultGroup.addParticle(rp3);
rp3.setFill(0x666666);
rp3.setLine(0, 0xff0000, 1);
rp3.sprite.name="rp3";
array.push(rp3);

for(i=1;i< 4;i++) { array[i].sprite.addEventListener(MouseEvent.MOUSE_DOWN,one); array[i].sprite.addEventListener(MouseEvent.MOUSE_UP,two); } function one(e1:MouseEvent):void { removeEventListener(Event.ENTER_FRAME,run); e1.target.startDrag(); } function two(e2:MouseEvent):void { array[e2.target.name.substr(2)].px=mouseX; array[e2.target.name.substr(2)].py=mouseY; stopDrag(); addEventListener(Event.ENTER_FRAME, run); } function run(evt:Event):void { APEngine.step(); APEngine.paint(); } } } } Example: APE with Dragable.swf

How to create rectangles & circles use APE & bounce effects

0

Posted by Sankar.G | Posted in | Posted on 4:31 PM

package {
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Sprite;
import org.cove.ape.*;

public class Test extends Sprite
{
private var wp:WheelParticle;
public function Test():void
{
stage.frameRate = 20;
addEventListener(Event.ENTER_FRAME, run);
APEngine.init(2/4);
APEngine.container = this;
var defaultGroup:Group = new Group();
defaultGroup.collideInternal = true;
APEngine.addMasslessForce(new Vector(0,2));

var rp:RectangleParticle = new RectangleParticle(250,300,200,10,0.52,true);
defaultGroup.addParticle(rp);
rp.setFill(0x666666);
rp.setLine(0, 0xff0000, 1);

var rp1:RectangleParticle=new RectangleParticle(490,300,200,10,-0.52,true);
defaultGroup.addParticle(rp1);
rp1.setFill(0xff0000);
rp1.setLine(0,0x666666,1);

var rp2:RectangleParticle=new RectangleParticle(430,450,200,10,0,true);
defaultGroup.addParticle(rp2);
rp2.setFill(0xff0000);
rp2.setLine(0,0x666666,1);

wp = new WheelParticle(280,10,25,false,10,0.3,0.1,1);
defaultGroup.addParticle(wp);
wp.setFill(0xff0000);
wp.setLine(0,0xff0000,0);

wp.sprite.addEventListener(MouseEvent.MOUSE_DOWN,down);

wp.sprite.addEventListener(MouseEvent.MOUSE_UP,up);

APEngine.addGroup(defaultGroup);

function down(d1:Event):void
{
removeEventListener(Event.ENTER_FRAME,run);
wp.sprite.startDrag();
}
function up(d2:Event):void
{
wp.px=wp.sprite.x;
wp.py=wp.sprite.y;
stopDrag();
addEventListener(Event.ENTER_FRAME, run);
}
function run(evt:Event):void
{
APEngine.step();
APEngine.paint();
}

}


}
}

Examples:

APE with out Drag.swf