Jump to content

States and Falling Sprites!


Recommended Posts

I have a problem with changing the state. All sprites "fall" off the screen right after the (second)

screen has changed. Only that "this.text" works, which is a string text!


What to do?! :(

create: function() {        currentstate = "screen1_state";        game.world.setBounds(0, 0, 800, 600);        //  We're going to be using physics, so enable the Arcade Physics system        this.game.physics.startSystem(Phaser.Physics.ARCADE);        map = game.add.tilemap('map2');        map.addTilesetImage('free_tileset_4', 'tileset2');        layerColl = map.createLayer(1);//collision layer - draw it first if you dont want to see it        map.setCollision(1, true, layerColl);        var layer0 = map.createLayer(0);//ground layer        var layer1 = map.createLayer(1);//lower body        var layer2 = map.createLayer(2);//upper body                var style = {font: "20px verdana", fill: "#ffffff"};        this.scoreText = game.add.text(700, 10, "Score: " + score, style);        this.text = this.game.add.text(20, 430, "Move with arrows", style);        this.bottle = this.game.add.sprite(450, 250, 'item');        this.hole = this.game.add.sprite(750, 450, 'item2');
Link to comment
Share on other sites


  • Recently Browsing   0 members

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