Legomite Posted August 27, 2015 Share Posted August 27, 2015 I have a game with a world that is split into multiple sections, each section has a container of their own. (I'm not really sure how camera works)It appears that from a earlier test in a older game I made, the camera makes the container that it is added to, moves. Everything else out of the container is static. Is it possible to make the sections (containers) put into 1 large container that the camera is added to? Is there another way? When I try it, all it does is freeze the game. I need help! Quote Link to comment Share on other sites More sharing options...
PixelPicoSean Posted August 28, 2015 Share Posted August 28, 2015 Yes you can put contains in another container. I always start like this:// Create a big world layer for everything affected by the camerathis.worldLayer = new game.Container().addTo(this.stage); this.backgroundLayer = new game.Container().addTo(this.worldLayer); this.middlegroundLayer = new game.Container().addTo(this.worldLayer); this.foregroundLayer = new game.Container().addTo(this.worldLayer);// Create a layer at the top for HUD and other UI elementsthis.uiLayer = new game.Container().addTo(this.stage);// Add the camera to the world layer and it works :Dcamera.addTo(this.worldLayer); Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted August 29, 2015 Share Posted August 29, 2015 Hahaha! PixelPicoSean I use exactly the same number of containers as you this.worldContainer = new game.Container().addTo(game.scene.stage);this.bg = new game.Container().addTo(this.worldContainer);this.mg = new game.Container().addTo(this.worldContainer);this.fg = new game.Container().addTo(this.worldContainer);this.ui = new game.Container().addTo(this.worldContainer); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.