OwnerOfSuccuby Wrote:No i am talking that i program on flash so strange - that nobody can understand me
Oh! Ok! Lets try
OwnerOfSuccuby Wrote:Start to watch your code. What is interesting for me - you use MovieClip(root) i use (root as MovieClip).*(some object on root or function)
They do the same As well as MovieClip(this.root).
OwnerOfSuccuby Wrote:As i understand you load all your functions on first frame and then call it.
Yes. It's the AS2 way. I was FAR WORSE in the beginning (<=2011) , with hundreds of on-object code (that is, in the right click of many movieclips). Then I removed all of them.
I cleaned up the code so far in a way I practically remade the game (in AS2)!
Then I am remaking it once again! (in AS3). I have progressed, but there are times my brains get stuck in a incredible way never felt before!
OwnerOfSuccuby Wrote:If i understand right you check each time on enter frame some variables when character already exist ? Like it was on LoK version 2 game ?
Yeah!!! And it works perfectly in AS2. I prefer to do this way because its just a 'if' that checks if a player variable changed its name. If Peach changed clothes, her hair will understand and change. Her arms will undersnd and change.
I prefer that way because, if not, I would have to name all bodypars in ALL 280scenes + 50 poses! Like peach_arm, peach_leg_left, peach_leg_right, in all instances! So the code can update those, without having to make ENTER FRAMES. I really want to avoid that at all costs!!! For me, its important that a given movieclip check if something has changed, in order for it to change! But even if I name all instances in order for the code to access it directly, a heavier problem will arise!
Please Imagine this situation ( I have lots and lots and lots and lots of creatures that uses this example):
That toadChars function does this (AS2):
- Code: Select All Code
stop();
onEnterFrame=function(){
if (_parent._parent._parent._color=="blue")
gotoAndStop("blue"); //head with blue mushroom
else if (_parent._parent._parent._color=="yellow")
gotoAndStop("yellow"); //head with red mushroom
//else (do nothing, remain at RED)
}
I can also work in the stage (ROOT), like calling:
- Code: Select All Code
MainClip(root).Level.ToadMain.toadSceneMain.ToadScene3.ToadHead.gotoAndStop("yellow");
But I dont know if the scene will be scene 3, I dont know if a given toad will have this head object, or a backside head object, or a frontside head object.
So I would need to make it more generic.
- Code: Select All Code
MainClip(root).Level.ToadMain.allScenes.currentScene.head.gotoAndStop("yellow");
Then I would need to put instance names for all parts that will get affected:
Man, this would make my work a nightmare! Just imagine giving instance names of toad foot, toad torso, toad arm, toad forearm.....in all 12+ scenes! How about the other 330+ scenes that i said above?
Then, for me, in the current situation of the game, I need to use ENTER FRAMES inside those objects.
Do you have another idea?
OwnerOfSuccuby Wrote:I use comand function that rearmor character on each change directly. Not use it on enter frame.
But this lead us to the problem above!
OwnerOfSuccuby Wrote:May be it is right to make event on rearm for example - to add event rearm to root - and listeners to it. If you monster do some thing he calls rearm function to change her armor - it is a little strange to check it on enter frame each time for me.
But then I need to instruct the rearm listener to go to the arm, leg, foot, head, of the current toad. Sometimes I use 'Toad scene 03 play' OUTSIDE of the Friend Toad Main (I use the Movieclip alone, separated), like in certain scenes in the blacksmith. I do this because I dont need 'Toad Main' (which is the main toad creature with tons of functions and all scenes). I just need ONE movieclip of the scene itself in that particular area. Then, the rearmor listener would need to search for
- Code: Select All Code
MainClip(root).Level.currentScene.head.gotoAndStop("yellow");
instead of
- Code: Select All Code
MainClip(root).Level.ToadMain.allScenes.currentScene.head.gotoAndStop("yellow").
OwnerOfSuccuby Wrote:I try to avoid this situation to put all MovieObjects in array - and check do they hittest each other, or make object that send to root comand - (Event=forExampleMyHit) - if it hit test the same type of object it screams to root layer, when other objects that add event listener on that screem to root layer hear it he do some thing to parent of that object for example.
Yes, I can do that too. Actually I already do that with some objects. I create an array, then the main loop checks if there is someone there, then I apply a given check. But I cant just do that, the game is already logically placed by using ENTER_FRAME listeners in many objects, and it worked so well in AS2 (onEnterFrame=function()).
OwnerOfSuccuby Wrote:Or may be i do not understand your code correct. I will try to look it more detailed tomorrow after work - it is too late now
Thank you : ) Just understand that the objects (movieclips) can be in different hierarchies. So a given Toad can be in the Level directly, for example (like he is drowning in a bucket of water hehe). Then the code would need to find:
- Code: Select All Code
MovieClip(root).Level.bucket.currentScene
But now I need to check if his Head, Arms, Torso, etc, changed clothes, because I can put a given code:
- Code: Select All Code
MovieClip(root).Level.bucket.currentScene._naked=true;
So the toad will respond immediatelly, by being naked! But only this head, and only in this case!!
Without ENTER FRAMES, I would need to search all toads in all areas, by different hierarchies! Some are in the ground (MovieClip(root).Level.ground.Toad) , other are in the toiled (MovieClip_root.Level.ground.toilet.Toad2), etc! Its far better to use a loop (ENTER FRAME) which will check if the current object (like his arm, head, torso, etc) has a parent._naked, or parent.parent._naked. Etc.
And NO, this isnt slow. The performance is not dropped, because I already tested it in my benchmarks. They're quite efficient
So we need brainstorming. :/
EDIT: Mariner has talked to me and its possible to extend classes which will do this work (of MAIN LOOPS in each object). I think that, by making the object in the stage call the associated class during its existence will avoid the problem with frames without ADDED TO STAGE listener, aside of more code organization.