View Full Version : [AS3] Game Implementation Question
Ciubhran
02-24-2009, 04:30 PM
I am considering making a game where there are two "views".
One being from the sky watching down on the world (2D), and a second where you are "in-combat" and the screen is redrawn to show another 2D view but from the side.
However, none of this matters. What my real question is, how would you suggest to implement this? Do I have to remove all the children and listeners before going into the "combat view", and then redraw and readd all of them once going out of combat?
bluemagica
02-24-2009, 04:38 PM
if there are nothing in common between the views, then i would just use two different movieclips, and nest the related objects within them! It becomes easy to manage this way, as if you remove the movieclip you won't have to bother with its children!
Ciubhran
02-24-2009, 04:41 PM
How do I swap between the MovieClips?
Right now I have nothing pre-determined (pre-drawn) on the screen of my game.
It is just a background color. Then the background map, units and scenery is loaded using Loaders. as Sprites/MovieClips.
And I have to unload all the units and scenery when going into combat, right?
Edit: How do I "nest" the objects within the MovieClips?
bluemagica
02-24-2009, 04:46 PM
first create a empty movieclip, then simply load and addChild your stuff within this movieclip! when you don't need it, just turn off visibility or remove the child!
Ciubhran
02-24-2009, 04:52 PM
Edit: I got it :)
I just addChild all my "world-view" entities onto the map, and when I remove visibility from that, everything "goes away". Perfect solution, thank you :D
davidrlorentz
02-25-2009, 03:29 PM
Of course for optimization purposes, keep in mind that if you set the movieclip to not visible, it'll still have plenty of processor overhead. It's nothing to worry about unless you have performance issues - in which case you might want to think about actually removing the movieclip from the display list and removing references to it, allowing it to be garbage collected. You'll then need to instantiate a new instance of it when you need it again.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.