Call Class to Align

hi there. i want to implement a class for Aligning purpose. The class should inherent the logic that is commented in the code.

  this.back = new Align(this.back,0.5);
    // this.back.displayWidth=game.config.width*.5;
    // this.back.scaleY=this.back.scaleX;

the class looks like this:

    class Align
  {
    static scaleToGameW(obj,per)
   {
     obj.displayWidth=game.config.width*per;
     obj.scaleY=obj.scaleX;
   }
 }

Hi @camouflaged_penguin, there is already align tools in phaser. Here you can see the examples. Maybe use these instead of creating =)

1 Like