Smash Blox

Smash Blox

Block Color

 

Block Class
export class Block extends Phaser.GameObjects.Sprite
{
constructor(config)
{
super(config.scene,0,0,"blocks");
config.scene.add.existing(this);

let colorIndex=Phaser.Math.Between(0,config.colorLimit-1);
this.setFrame(colorIndex);
}
}

Scene Main Create

create() {
//set up the base scene
super.create();
//set the grid for the scene
this.makeAlignGrid(11, 11);
//show numbers for layout and debugging
//
this.aGrid.showNumbers();
this.numberOfColors=5;
//
//
//
this.makeUi();
let block=new Block({scene:this,colorLimit:this.numberOfColors});
this.placeAtIndex(60,block);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments are closed.