Immediately kills the specified actor.
If killing the current actor from its own actor behavior, the remaining logic will continue to run. We recommending using the stop block to prevent errors from happening in this case.
recycleActor([ACTOR]);
Instructs the game to kill the actor if it exits the screen. This is useful for "bullets" and other temporary actors that aren't of much use to hold around once they're off the screen.
[ACTOR].killSelfAfterLeavingScreen();
Returns true
if the specified actor is alive. Useful for checking prior to performing operations with that actor -- working with a dead actor may cause the game to crash.
[ACTOR].isAlive()
Returns the width or height of the actor.
([ACTOR].getWidth())
([ACTOR].getHeight())
([ACTOR].getWidth()/2)
([ACTOR].getHeight()/2)
Returns the actor's Actor Type.
[ACTOR].getType()
Returns the actor's (Collision) Group.
[ACTOR].getGroup()
Returns the chosen Actor Type.
[ACTOR TYPE]
Returns the chosen Actor Group. Useful for making comparisons in collision events.
getActorGroup([INT])
Retrieves an Actor Type by name and returns it if it exists.
getActorTypeByName([TEXT])
Override the default collision response between two groups.
Collision.addResponse([ACTORGROUP], [ACTORGROUP], "sensor");
Collision.addResponse([ACTORGROUP], [ACTORGROUP], "solid");
Normally, actors stop updating after they're off-screen. This block can turn that option off and makes them always active no matter where they are. Choosing "sometimes" sets the actor to the default behavior.
[ACTOR].makeAlwaysSimulate();
[ACTOR].makeSometimesSimulate();
Toggles whether an actor travels through terrain at high speeds.
makeActorNotPassThroughTerrain([ACTOR]);
makeActorPassThroughTerrain([ACTOR]);
Adds a new box collision shape to the actor's current animation.
[ACTOR].addRectangularShape([NUMBER], [NUMBER], [NUMBER], [NUMBER]);
Adds a new circle collision shape to the actor's current animation.
[ACTOR].addCircularShape([NUMBER], [NUMBER], [NUMBER]);
Adds a new polygon collision shape to the actor's current animation. Specify the points using the next vertex
block right below.
var polygonActor:Actor = [ACTOR];
var vertices:Array<B2Vec2> = new Array<B2Vec2>();
[ACTIONS]
polygonActor.addPolygonalShape(vertices);
Adds a point to the newly created polygon collision shape. Must be used in the add polygonal collision shape
block above.
polygonActor.addVertex(vertices, [NUMBER], [NUMBER]);
Lets you perform certain actions on each collision shape for the actor. Use the make the shape solid / a sensor
, remove the shape
and scale the shape
blocks below.
var shapeActor:Actor = [ACTOR];
if (shapeActor.physicsMode == 0) {
var fixture:B2Fixture = shapeActor.getBody().getFixtureList();
while (fixture != null) {
[ACTIONS]
fixture = fixture.getNext();
}
}
Sets the collision shape to be solid or a sensor (not solid but still can detect collisions).
[COLLISION SHAPE].setSensor(true); //Make it a sensor
[COLLISION SHAPE].setSensor(false); //Make it solid
Removes the collision shape from the actor.
[COLLISION SHAPE].getBody().DestroyFixture([COLLISION SHAPE]);
Resizes the collision shape in percentage terms, relative to the original size (100%).
Actor.scaleShape([COLLISION SHAPE].getShape(), [COLLISION SHAPE].getBody().getLocalCenter(), [NUMBER] / 100);
Returns the collision group assigned to a shape. Normally the group of the actor type the shape is attached to.
engine.getGroup([COLLISION SHAPE].groupID, [COLLISION SHAPE].getUserData())
Sets the collision group for this shape.
[COLLISION SHAPE].groupID = [ACTORGROUP].ID;
Returns the last collision shape added to the actor.
[ACTOR].getLastCreatedFixture()
Associates a value with the given text key. Useful for storing (and later retrieving) arbitrary data in an actor without having to do this through other means in the toolset.
[ACTOR].setActorValue([TEXT], [VALUE]);
Returns the value that is associated with the given text key, if available. Returns null
if it doesn't exist.
[ACTOR].getActorValue([TEXT])