spiderworm Posted January 8, 2014 Share Posted January 8, 2014 Hi, I have a game with two states. A sprite (called player) is created in the first state and stored in the first state. In my second state, in create, I call:this.game.add.existing(player);But the player sprite never appears in the second state. player.alive, player.exists, player.visible, and player.renderable are all true. Any hints on sharing sprites between states? Link to comment Share on other sites More sharing options...
rich Posted January 8, 2014 Share Posted January 8, 2014 I would remove it from the world when State 1 ends, and then re-add it in State2, as the world gets purged during a state swap and is probably semi-clearing the sprite down. Link to comment Share on other sites More sharing options...
spiderworm Posted January 8, 2014 Author Share Posted January 8, 2014 I would remove it from the world when State 1 ends, and then re-add it in State2, as the world gets purged during a state swap and is probably semi-clearing the sprite down. That does work, actually. Cool! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts