Jump to content

Scaling loading bar not works correctly


diesel94
 Share

Recommended Posts

Bowmasters.Preloader = function(game){

};

Bowmasters.Preloader.prototype = {
    preload: function() {
        let logo = this.add.sprite(this.game.world.centerX -120, this.game.world.centerY - 100, 'logo').scale.setTo(scaleRatio, scaleRatio);

        let bar = this.add.sprite(this.game.world.centerX-300,this.game.world.centerY, 'bar');

        bar.scale.setTo(scaleRatio, scaleRatio);

        //without next line loading sprite looks good, not cropped
        this.load.setPreloadSprite(bar);

        this.load.image('background', 'assets/Resources/BG/bm_bg.png');
        this.load.image('ground', 'assets/Resources/BG/bm_ground.png');
        this.load.image('icon_thor', 'assets/Resources/UI/icon_thor_odinson.png');
        this.load.image('icon_loki', 'assets/Resources/UI/icon_upgrade_loki.png');


    },
    create: function() {
        this.state.start('Game');
    }
};

 

 

this.load.setPreloadSprite(bar)   sprite looks good.

82e9e0cc-61b6-41c6-ae7a-17c2312045b2.jpg.c0314211891764536080d14f615e3f14.jpg

 

After using bar.scale.setTo it becomes like:

dff8ee53-1c42-4115-8402-c1bd1035505b.jpg.e4628b955809501411451e5c70a3e29b.jpg

 

This is my code, i am gonna to create loadind scene but i have a problem with loading bar. This was too big, and when i try to scale it becomes cropped  as on the screenshots. Give me the hint please how to repair it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...