Jump to content

TileSprite doesn't work correct for me. Please help


san40511
 Share

Recommended Posts

I tried repeat my image and scroll but something went wrong. it doesn't work bg appear as normal image and I see the picture like this. It just scrolled but not repeated.

screenshot : 

Снимок экрана 2016-05-06 в 22.45.38.png

 

window.onload = function () {
    var width = 640;
    var height = 960;
    var windowRatio = window.innerWidth / window.innerHeight;
    if (windowRatio < width / height) {
        height = width / windowRatio;
    }
    game = new Phaser.Game(width, height, Phaser.AUTO,"");

    game.state.add("PlayGame", playGame);
    game.state.start("PlayGame");

};

playGame.prototype = {
    render : function () {
        game.scale.pageAlignHorizontally = true;
        game.scale.pageAlignVertically = true;
        game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
    },
    preload: function () {
        game.stage.disableVisibilityChange = true;
        game.load.image("base", "base.png");
    },


    create: function () {
        this.bg = game.add.tileSprite(0,0, game.width, game.height, 'base');
    },
    update : function(){
        this.bg.x--
    }
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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