Actor > Properties


Alive / Dead

Kill Actor

kill-actor-block

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]);

Kill Actor (after leaving screen)

kill-actor-later-block

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();

Is Actor alive?

exists-actor-block

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()

Size

Get Width / Height

size-actor-block

Returns the width or height of the actor.

([ACTOR].getWidth())
([ACTOR].getHeight())

Groups / Types

Get Actor Type

gettype-actor-block

Returns the actor's Actor Type.

[ACTOR].getType()

Get Group

group-actor-block

Returns the actor's (Collision) Group.

[ACTOR].getGroup()

Choose Actor Type

choose-actor-block

Returns the chosen Actor Type.

[ACTOR TYPE]

Choose Actor Group

choose-group-block

Returns the chosen Actor Group. Useful for making comparisons in collision events.

[ACTOR GROUP]

Get Actor Type (from name)

pick-type-name-block

Retrieves an Actor Type by name and returns it if it exists.

getActorTypeByName([TEXT])

Misc

Make Actor Always Active

always-simulate-actor-block

Normally, actors stop updating after they're off-screen. This block turns that option off and makes them always active no matter where they are.

[ACTOR].makeAlwaysSimulate();

Enable Continuous Collision Detection

ccd-actor-block

Enables continuous collision detection for the specified actor.

makeActorNotPassThroughTerrain([ACTOR]);

Collision Shapes

Add Rectangle Collision Shape

rect-shape-actor-block

Adds a new box collision shape to the actor's current animation.

[ACTOR].addRectangularShape([NUMBER], [NUMBER], [NUMBER], [NUMBER]);

Add Circle Collision Shape

circle-shape-actor-block

Adds a new circle collision shape to the actor's current animation.

[ACTOR].addCircularShape([NUMBER], [NUMBER], [NUMBER]);

Add Polygon Collision Shape

poly-shape-actor-block

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);

Add Point to Polygon Shape

point-add-actor-block

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]);

For Each Collision Shape...

foreach-shape-actor-block

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 body:B2Body = shapeActor.getBody();
    var fixture:B2Fixture = body.getFixtureList();
    while (fixture != null){
        [ACTIONS]
        fixture = fixture.getNext();
    }
}

Make Collision Shape Solid / Sensor

solid-sensor-shape-actor-block

Sets the collision shape to be solid or a sensor (not solid but still can detect collisions). Must be used within the for each collision shape block above.

fixture.setSensor(true); //Make it a sensor
fixture.setSensor(false); //Make it solid

Remove Collision Shape

remove-shape-actor-block

Removes the collision shape from the actor. Must be used within the for each collision shape block above.

body.DestroyFixture(fixture);

Resize Collision Shape

resize-shape-actor-block

Resizes the collision shape in percentage terms, relative to the original size (100%). Must be used within the for each collision shape block above.

Actor.scaleShape(fixture.getShape(), body.getLocalCenter(), [NUMBER] / 100);

Properties

Set Actor Value

set-val-actor-block

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]);

Get Actor Value

get-val-actor-block

Returns the value that is associated with the given text key, if available. Returns null if it doesn't exist.

[ACTOR].getActorValue([TEXT])

Convert to Boolean

cast-bool-block

Converts the value to a Boolean. Meant to be used in conjunction with the get-actor-value block.

asBoolean([VALUE])

Convert to Number

cast-number-block

Converts the value to a Number. Meant to be used in conjunction with the get-actor-value block.

asNumber([VALUE])

Convert to Text

cast-text-block

Converts the value to a Text value. Meant to be used in conjunction with the get-actor-value block.

("" + [VALUE])