dynamic createActor(Actor actor)

Creates a new actor in the view based on the model.

Source

createActor(Actor actor) {
    // Check if running
    if (!isRunning) return;

    // Check if Actor already exists.
    var el = get(actor.name);
    if (el != null) return;

    // Handle Character seperately.
    if (actor is Character) {
        _createCharacter(actor);
        return;
    }

    // Create Actor Element
    el = create(get("world"), actor.name);

    // Mark Element as Actor
    el.classes.add("actor");

    // Make Actor circular if necessary
    if (actor.isCircleCollider) el.classes.add("circle");


    //Branch to Pawn or Prop
    if (actor is Pawn) _applyPawn(el, actor);
    else
    if (actor is Prop) _applyProp(el, actor);
}