Iso box

Introduction

Iso-box shape, built-in game object of phaser.

  • Author: Richard Davey

Usage

Create shape object

var isoBox = scene.add.isobox(x, y, size, height, fillTop, fillLeft, fillRight);

Custom class

  • Define class
    class MyIsoBox extends Phaser.GameObjects.IsoBox {
        constructor(scene, x, y, size, height, fillTop, fillLeft, fillRight) {
            super(scene, x, y, size, height, fillTop, fillLeft, fillRight);
            // ...
            scene.add.existing(this);
        }
        // ...
    
        // preUpdate(time, delta) {}
    }
    
    • scene.add.existing(gameObject) : Adds an existing Game Object to this Scene.
      • If the Game Object renders, it will be added to the Display List.
      • If it has a preUpdate method, it will be added to the Update List.
  • Create instance
    var isoBox = new MyIsoBox(scene, x, y, size, height, fillTop, fillLeft, fillRight);
    

Set color

  • Fill color
    isoBox.setFillStyle(fillTop, fillLeft, fillRight);
    
  • Show face
    isoBox.setFaces(showTop, showLeft, showRight);
    
    • showTop, showLeft, showRight: Set true to show that face

No tint methods

Uses isoBox.setFillStyle(fillTop, fillLeft, fillRight) to change color.

Projection

  • Get
    var projection = isoBox.projection;
    
  • Set
    isoBox.setProjection(value)
    
    or
    isoBox.projection = value;
    

Other properties

See game object