jzcoder Posted January 26, 2014 Share Posted January 26, 2014 When we start a new state after the camera has moved over a tilemap world, we can't seem to reset the camera position. I've tried calling this.camera.setPosition(0,0) and this.camera.view.y = 0, but this does not seem to work. Link to comment Share on other sites More sharing options...
jpdev Posted January 31, 2014 Share Posted January 31, 2014 I ran into the same problem, and google send me here. My problem was, a button placed in the menu-state with:this.btn = this.game.add.button(this.game.world.centerX, this.game.world.centerY, 'startBtn', this.startgame);Was no longer visible after returning to this state from the game (which uses a tilemap). The solution was to reset the world bounds before creating the button, like this: this.game.world.setBounds(0, 0, this.game.width, this.game.height);Turns out (found out by debugging) that my button was placed at x=24000, y=400 ... because in my gamestate my tilemap-layer is 48000 pixel long, and I call resizeWorld on the layer. Solution: Resize the World to the screen size for the main menu. AlexArroyoDuque 1 Link to comment Share on other sites More sharing options...
Recommended Posts