Page 1 of 1

Need some help (AS2).

PostPosted: Wed Mar 06, 2013 5:55 pm
by Sysethe
Hello!
To begin with, I'm new user, but i have been following this forum log time before great Corta's had "left" us. I'm also sorry for my poor english grama :oops: .

SO ! The thing is that i decided to begin my adventure with MacromediaFlash (currently 8 but i can get it upgraded, of course in legal way :roll:) and i need some help in few things. I just started to "write" basic things wchich aren't that basic as you think I'm able to write ;) .

I'm still trying to understand how arrays and objects works and use them as i would like. To add i'm IT student (first year) and my programmer skills will improve in time.

Howewer i'm easy learner, so with a little help i'd be able to create some nice stuff.

Just a curio of my game:
Inspired with CoC and other girls-morph games i'd make player pet "upgradeable" with transforming various body parts, adding new by using items, participating events, submiting, denying, fighting etc. It'll be shown as perks affecting stats, giving additionall passive/active skills/event solutions. Yea right. I know what you think. Soooo basic. Another dumb guy with dumb ideas :lol: BUT!
As a Rp fanatic i can't see the point of cow-morph girl equiped with sub-machine gun or using great arcane power. I thought "why don't give player pet AI that various morphs will affect his/her behaviour in the way it should? ". I'd like to leave some control like grabbing loot or pointining special event items that will occur from time to time.
To make it clear. Player at start will have to choose hispersonality. Something like Devil/Succuba/Palladin etc. Player would be kind of his pet patron, so his personality will affect basic pet stats, probability of various(I love this word <3) events. Then player will be moved to specific lair (according to his personality) and presented with "pets" he can choose. I'm also thinking about other way of choosing it. Something like instead of lair he'll be moved to random map with 1 lvl enemies and with last call of his GOD power :o affect choosen one wchich then will be moved to lair.
There player will be able to set some options(like map for next exploring), feed his pet, equip it, etc. Of course i'd like to make some events here to happens too. For example "Puff, she's giving a birth ! Puff, it's a "smthing"!" Then player would be presented with option to use offspring instead of mother.
Ok, ok. Move on :lol:.
After choosing map, eq, etc. player pet will be moved where player chossed and we can watch how she/he explores map with random number of enemies/spawns and events. To complete the map, player have to wait for portal that will appear after some time. If his pet died before, everything it earned is lost and we're back in the lair.

It's just part of what i would like to have in game. I skipped a lot of ideas to not overload this thread. If youd like it i'll make right one in right place ;).

To the point:
I tried compare 2 codes that aren't mine so don't flame ;d. In first one enemy is treaten as object, in second only added to array (or i'm blind and stupid).
Enemies should follow player and the closest one should be stucked in frame(2) ;p.
Just if you could point where i make mistakes. It'll make me learn it faster ;d. Just don't laugh if i messed all. Please :d



Code: Select All Code
var health:Number = 100;
var radians:Number = 180/Math.PI;

healthbar_mc.onEnterFrame = function()
{
healthbar_mc._xscale=_root.health*1;
if(_root.health<=0){
health=0;
}
if(_root.health>=100){
health=100;
}
}
button_btn.onRelease = function(koma)
   {
   _root.health = _root.health - 10;
   if(_root.health!=0)
               {
               trace(_root.health);
               removeMovieClip(button_btn);
               };
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

var enemyObjectsArray:Array = [];

/**
* Create Enemy
* ---------------
* This Method is used to create new enemy objects,
* attach movieClips to them and set the enemyObject's properties like position
*/
function createEnemy(numberOfEnemies:Number, enemyBehavior:String, enemyLibraryClip:String):Void
{
   //run a for loop to create numberOfEnemies
   for(var i = 0; i < numberOfEnemies; i++)
   {
      //attach a new enemy movieclip from the library
      var tempEnemy_mc:MovieClip = _root.attachMovie(enemyLibraryClip, enemyLibraryClip+_root.getNextHighestDepth(), _root.getNextHighestDepth());
      
      //set new enemy position
      tempEnemy_mc._x = random(Stage.width);
      tempEnemy_mc._y = random(Stage.height);
      
      //
      
      //set enemy behavior
      if(enemyBehavior == "typeA")
      {
         //define enemy characteristics
         tempEnemy_mc.speed = 1
         tempEnemy_mc.turnRate = .05
         tempEnemy_mc.agroRange = 200;
         tempEnemy_mc.mode = "follow"
      }
      else if(enemyBehavior == "typeB")
      {
         //define enemy characteristics
         tempEnemy_obj.speed = 4
         tempEnemy_obj.turnRate = .5
         tempEnemy_obj.agroRange = 200;
         tempEnemy_obj.mode = "follow"
      }
      else if(enemyBehavior == "typeC")
      {
         //define enemy characteristics
         tempEnemy_obj.speed = 1
         tempEnemy_obj.turnRate = .2
         tempEnemy_obj.agroRange = 100;
         tempEnemy_obj.mode = "run"
      }
      
      //save object properties such as a reference to our movieClip on root, distance total, etc
      tempEnemy_obj = {myMc:tempEnemy_mc, distanceTotal:0, distanceY:0, distanceY:0, moveDistanceX:0, moveDistanceY:0, moveX:0, moveY:0, totalmove:0}
      
      //add the enemy object to array
      enemyObjectsArray.push(tempEnemy_obj);
   }
}

/**
* Update Enemy
* ---------------
* This Method is used to calculate distance between objects in enemyObjectsArray
* and sort the array based on distanceTotal using the "sortOn" function
*/
function updateEnemies():Void
{
   //run a for loop on our array and update every enemy object in there
   for(var i = 0; i < enemyObjectsArray.length; i++)
   {
      //set temporary variables that we'll use to reference the enemy/target
      //enemy is an object
      var enemy:Object = enemyObjectsArray[i];
      //player_mc is a movieclip
      var target:MovieClip = player_mc;
      
      
      
      //To use movieClip method like gotoAndStop, gotoAndPlay, etc,
      //we use the "myMc" parameter of our enemy object that we saved earlier.
      //The mc parameter is basically a "link" to the enemy movieClip on stage
      
      //tell movieclip to go to first frame
      enemy.myMc.gotoAndStop(1);

      //calculate distance between enemyObject's movieClip and target
      enemy.distanceX = target._x - enemy.myMc._x;
      enemy.distanceY = target._y - enemy.myMc._y;
      
      //get total distance as one number
      enemy.distanceTotal = Math.sqrt(enemy.distanceX * enemy.distanceX + enemy.distanceY * enemy.distanceY);
      
      //sort the array based on the enemy object's "distanceTotal" parameter
      enemyObjectsArray.sortOn("distanceTotal", Array.NUMERIC);
      //the first item in our array (enemyObjectsArray[0])
      //has the lowest distanceTotal value hense its the closest
      
      //tell the closest enemy movieClip to go to frame 2 to visually show that it's closest
      enemyObjectsArray[0].myMc.gotoAndStop(2);
      
      updatePosition(tempEnemy_mc, player_mc);
   }
}

//
// updatePosition(follower, target)
// use ex: updatePosition(myEnemyMovieClip, playerMovieClip)
//
function updatePosition(follower:MovieClip, target:MovieClip) {
   
   //calculate distance between follower and target
   follower.distanceX = target._x-follower._x;
   follower.distanceY = target._y-follower._y;
   
   //get total distance as one number
   follower.distanceTotal = Math.sqrt(follower.distanceX * follower.distanceX + follower.distanceY * follower.distanceY);
   
   //check if target is within agro range
   if(follower.distanceTotal <= follower.agroRange){
      
      //calculate how much to move
      follower.moveDistanceX = follower.turnRate * follower.distanceX / follower.distanceTotal;
      follower.moveDistanceY = follower.turnRate * follower.distanceY / follower.distanceTotal;
      
      //increase current speed
      follower.moveX += follower.moveDistanceX;
      follower.moveY += follower.moveDistanceY;
      
      //get total move distance
      follower.totalmove = Math.sqrt(follower.moveX * follower.moveX + follower.moveY * follower.moveY);
      
      //apply easing
      follower.moveX = follower.speed * follower.moveX / follower.totalmove;
      follower.moveY = follower.speed * follower.moveY / follower.totalmove;
      
      //move & rotate follower
      if(follower.mode == "follow")
      {
         follower._x += follower.moveX;
         follower._y += follower.moveY;         
         follower._rotation = Math.atan2(follower.moveY, follower.moveX) * radians;
      }
      else if(follower.mode == "run")
      {
         follower._x -= follower.moveX;
         follower._y -= follower.moveY;
         follower._rotation = (Math.atan2(follower.moveY, follower.moveX) * radians)+180;
      }
      
      
   }
}


///////////////////////////////////////////////////////////////////////////////////



//add an onEnterFrame to repeat our updateEnemies function every frame
_root.onEnterFrame = function():Void
{
   updateEnemies();
   
}


//create some enemies
createEnemy(random(10+1), "typeA", "enemy1_mc");
createEnemy(random(10+1), "typeC", "enemy2_mc");


//start/stop drag for player_mc
player_mc.onPress = function(){
   startDrag(this);
}
player_mc.onRelease = function(){
   stopDrag();
}


////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////

Re: Need some help (AS2).

PostPosted: Wed Mar 06, 2013 6:29 pm
by OwnerOfSuccuby
Hello. But i little do not understand what do you want :mrgreen: :roll:

Is it some kind of logic mistake or what ? Can you post swf example of how it works to understand it better ?

Re: Need some help (AS2).

PostPosted: Wed Mar 06, 2013 6:46 pm
by Sysethe
Ok.
Attached swf with example of use. Closest enemy is pointed(jmp to frame2) but none of them follows. Stucked here can't do anything later.

I think it's clear as possible. ;p
And sorry for unclear code ;)

//EDIT
Btw. this "search for closest enemy" will be part of "pets" AI. ;p

Re: Need some help (AS2).

PostPosted: Wed Mar 06, 2013 10:10 pm
by OwnerOfSuccuby
Ok i understand now what do you want from it :mrgreen:

But it is some questions about it:

Can you share its source *.fla ?

If not try to wright this :

Code: Select All Code
var health:Number = 100;
var radians:Number = 180/Math.PI;

healthbar_mc.onEnterFrame = function()
{
healthbar_mc._xscale=_root.health*1;
if(_root.health<=0){
health=0;
}
if(_root.health>=100){
health=100;
}
}
button_btn.onRelease = function(koma)
   {
   _root.health = _root.health - 10;
   if(_root.health!=0)
               {
               trace(_root.health);
               removeMovieClip(button_btn);
               };
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

var enemyObjectsArray:Array = [];

/**
* Create Enemy
* ---------------
* This Method is used to create new enemy objects,
* attach movieClips to them and set the enemyObject's properties like position
*/
function createEnemy(numberOfEnemies:Number, enemyBehavior:String, enemyLibraryClip:String):Void
{
   //run a for loop to create numberOfEnemies
   for(var i = 0; i < numberOfEnemies; i++)
   {
      //attach a new enemy movieclip from the library
      var tempEnemy_mc:MovieClip = _root.attachMovie(enemyLibraryClip, enemyLibraryClip+_root.getNextHighestDepth(), _root.getNextHighestDepth());
     
      //set new enemy position
      tempEnemy_mc._x = random(Stage.width);
      tempEnemy_mc._y = random(Stage.height);
     
      //
     
      //set enemy behavior
      if(enemyBehavior == "typeA")
      {
         //define enemy characteristics
         tempEnemy_mc.speed = 1
         tempEnemy_mc.turnRate = .05
         tempEnemy_mc.agroRange = 200;
         tempEnemy_mc.mode = "follow"
      }
      else if(enemyBehavior == "typeB")
      {
         //define enemy characteristics
         tempEnemy_obj.speed = 4
         tempEnemy_obj.turnRate = .5
         tempEnemy_obj.agroRange = 200;
         tempEnemy_obj.mode = "follow"
      }
      else if(enemyBehavior == "typeC")
      {
         //define enemy characteristics
         tempEnemy_obj.speed = 1
         tempEnemy_obj.turnRate = .2
         tempEnemy_obj.agroRange = 100;
         tempEnemy_obj.mode = "run"
      }
     
      //save object properties such as a reference to our movieClip on root, distance total, etc
      tempEnemy_obj = {myMc:tempEnemy_mc, distanceTotal:0, distanceY:0, distanceY:0, moveDistanceX:0, moveDistanceY:0, moveX:0, moveY:0, totalmove:0}
     
      //add the enemy object to array
      enemyObjectsArray.push(tempEnemy_obj);
   }
}

/**
* Update Enemy
* ---------------
* This Method is used to calculate distance between objects in enemyObjectsArray
* and sort the array based on distanceTotal using the "sortOn" function
*/
function updateEnemies():Void
{
   //run a for loop on our array and update every enemy object in there
   for(var i = 0; i < enemyObjectsArray.length; i++)
   {
      //set temporary variables that we'll use to reference the enemy/target
      //enemy is an object
      var enemy:Object = enemyObjectsArray[i];
      //player_mc is a movieclip
      var target:MovieClip = player_mc;
     
     
     
      //To use movieClip method like gotoAndStop, gotoAndPlay, etc,
      //we use the "myMc" parameter of our enemy object that we saved earlier.
      //The mc parameter is basically a "link" to the enemy movieClip on stage
     
      //tell movieclip to go to first frame
      enemy.myMc.gotoAndStop(1);

      //calculate distance between enemyObject's movieClip and target
      enemy.distanceX = target._x - enemy.myMc._x;
      enemy.distanceY = target._y - enemy.myMc._y;
     
      //get total distance as one number
      enemy.distanceTotal = Math.sqrt(enemy.distanceX * enemy.distanceX + enemy.distanceY * enemy.distanceY);
     
      //sort the array based on the enemy object's "distanceTotal" parameter
      enemyObjectsArray.sortOn("distanceTotal", Array.NUMERIC);
      //the first item in our array (enemyObjectsArray[0])
      //has the lowest distanceTotal value hense its the closest
     
      //tell the closest enemy movieClip to go to frame 2 to visually show that it's closest
      enemyObjectsArray[0].myMc.gotoAndStop(2);
     
      updatePosition(tempEnemy_mc, player_mc);
   }
}

//
// updatePosition(follower, target)
// use ex: updatePosition(myEnemyMovieClip, playerMovieClip)
//
function updatePosition(follower:MovieClip, target:MovieClip) {
   
   //calculate distance between follower and target
   follower.distanceX = target._x-follower._x;
   follower.distanceY = target._y-follower._y;
   
   //get total distance as one number
   follower.distanceTotal = Math.sqrt(follower.distanceX * follower.distanceX + follower.distanceY * follower.distanceY);

trace(“follower.distanceTotal”);
trace(follower.distanceTotal);   
trace(“follower.agroRange”);
trace(follower.agroRange);


   //check if target is within agro range
   if(follower.distanceTotal <= follower.agroRange){
     
      //calculate how much to move
      follower.moveDistanceX = follower.turnRate * follower.distanceX / follower.distanceTotal;
      follower.moveDistanceY = follower.turnRate * follower.distanceY / follower.distanceTotal;
     
      //increase current speed
      follower.moveX += follower.moveDistanceX;
      follower.moveY += follower.moveDistanceY;
     
      //get total move distance
      follower.totalmove = Math.sqrt(follower.moveX * follower.moveX + follower.moveY * follower.moveY);
     
      //apply easing
      follower.moveX = follower.speed * follower.moveX / follower.totalmove;
      follower.moveY = follower.speed * follower.moveY / follower.totalmove;
     
      //move & rotate follower
      if(follower.mode == "follow")
      {
         follower._x += follower.moveX;
        trace(“follower._x”);
        trace(follower._x);
         follower._y += follower.moveY; 
trace(“follower._y”);
        trace(follower._y);       
         follower._rotation = Math.atan2(follower.moveY, follower.moveX) * radians;
      }
      else if(follower.mode == "run")
      {
         follower._x -= follower.moveX;
         follower._y -= follower.moveY;
  trace(“follower._x”);
        trace(follower._x);
  trace(“follower._y”);
        trace(follower._y);
         follower._rotation = (Math.atan2(follower.moveY, follower.moveX) * radians)+180;
      }
trace("follower.mode”);
trace(follower.mode);

     
     
   }
}


///////////////////////////////////////////////////////////////////////////////////



//add an onEnterFrame to repeat our updateEnemies function every frame
_root.onEnterFrame = function():Void
{
   updateEnemies();
   
}


//create some enemies
createEnemy(random(10+1), "typeA", "enemy1_mc");
createEnemy(random(10+1), "typeC", "enemy2_mc");


//start/stop drag for player_mc
player_mc.onPress = function(){
   startDrag(this);
}
player_mc.onRelease = function(){
   stopDrag();
}


And copy paste what it will trace there please :mrgreen:

But if *.fla can be shared and you can post it there do so please it will be more easy to look what is not working correctly.

Re: Need some help (AS2).

PostPosted: Wed Mar 06, 2013 11:02 pm
by Sysethe
Oh my friend i'm affraid that you think i have something done. I was only going through fla tutorials and basic scripts. Even this one up is only for testing. As i said i still need to learn how to well use arrays and objects. Earlier i was trying to make simpler games (like those in tutorials here) but they base only on menus. I hope you know what i mean... Game based on Click!-> stage one, Click!-> stage two, Click! -> GameOver, just isn't a game :P. It's more like PowerPoint presentation(if i right spelled it xD). So i decided to try do something more. But when i get something working, it's not compatible with next code i want to include. So after few "Damn i fucked it up. Let's start it again" I decided to learn writting random things that i'll need later.

Damn it's getting late my english is getting really bad :D.

Inspired by that cow with submachine guns ^^ made some poor stuff while waiting for response (without guns :P). I'm not a brilliant painter but things starts to remind body parts xD. I also need to learn how to modulate colors :) I hope you'd like it ;p

//EDIT

Just forgot to add - your code gives mi endless "Undefined" for all followers.* :|

Re: Need some help (AS2).

PostPosted: Thu Mar 07, 2013 12:23 am
by OwnerOfSuccuby
enemyObjectsArray[0].myMc.gotoAndStop(2);

updatePosition(tempEnemy_mc, player_mc);


If they are undefined - than may be you give wrong object to your next function ;)

Try to replace Red on Green in your code - may be it will work. Becouse may be i mistake but i did not understand what is in tempEnemy_mc - in the moment when you make this (enemyObjectsArray[0].myMc) go to 2 frame.

As i understand bla bla bla.myMc - is the nearest object on this moment but what is tempEnemy_mc - is a big question for me :mrgreen:

Do not worry - i am the man with the worst English on this forum :roll: :mrgreen: :lol:

Thats why i always ask to write more simple, and some times do not understand people :roll: :mrgreen:

Try to make program easy to understand. It have to have more simple logic. If you make some thing such with hard structure - it is hard to work with.

When you remember how you make it it is okay - but when you make the next part of it you forget some parts of what you make earlyer - and then it becomes very hard to work with.

Some times it is better to make simple thing with out optimization - then hard thing with optimization - but the thing with you will not be comfortable to work in future ;)

Re: Need some help (AS2).

PostPosted: Thu Mar 07, 2013 12:47 pm
by Sysethe
Thanks. Now I know that the math functions works for enemy1(have to figure out why enemy2 is still undefinied in mode ;p) but they still don't follow player :P.

And i'm thinkink about start writting base of game solving problems step by step :P

Re: Need some help (AS2).

PostPosted: Thu Mar 07, 2013 7:27 pm
by OwnerOfSuccuby
For example - you can check if enemy is on first frame - if he is on 2 frame you can activate function in that object on frame 2 - that if he is on frame 2 - he have to follow the player.

Or even chech all it on the enemy object - and then you can add remove it with out mistakes in code.

There are different ways how to make one thing ;)

Re: Need some help (AS2).

PostPosted: Thu Mar 07, 2013 8:29 pm
by Sysethe
First thought "brilliant idea". But then i realised that it would be usefull to make Player pet follow enemy. In vice versa it would only make 1 enemy follow player but its nice thing it it self to use "somehow" xD. And i think I wouldn't be practical making 2 same animations of enemy when 1 would be if he's closest enemy and second for farther. It would be pointless ;p.

Re: Need some help (AS2).

PostPosted: Fri Mar 08, 2013 2:02 pm
by OwnerOfSuccuby
It is not he optimized solution but now i am thinking about some thing like:

You get variable to the root layer - for example - MyVarWhatNameOfEnemyMustFollowPlayer.

And if this name is for example name that you need that object move.

Or all other objects will be on frame one - and only object you nedd will be on the frame 2 - so you can write that code on the frame 2.

So when it will enter frame 2 - and if frame will be 2 it will execute code that will let object folow to your player.

Or make frame 3 the same as frame 2 - and when object will get to the frame 2 it will resend it like gotoandplay(3) or gotoAndStop(3) - on the 3 frame code will execute and object will move.

For example now only object you need is selected is he ? ;) So only one object is on the 2 frame and you can post code there :mrgreen:

---

If you need all enemys follow the player you jst can put it all code in there object - so it will check all by itself and do what it will need. You will not need to check anything from root layer then.

Re: Need some help (AS2).

PostPosted: Fri Mar 08, 2013 4:13 pm
by Sysethe
No not exacly selected one. The selected one should be followed by player. All other enemies depend of their "mode" ("run", "follow") should follow or run when they are in various range.

Next step in follow/run system would be involving lvl difference. But it would only affect player making him running or following from enemies. It'll also be connected with player pet AI.

It'll take me a lot of time to connect that all. ;p

But you gave me good idea in this frame settings. The closest enemy won't go to frame two. Instead of that. I'll make arrow over it's head, which won't be visible in its frame 1.
Enemy.Arrow.gotoAndPlay(2)
It wont affect enemy frames because it'll be included in all of them in other layer " |o---------------------->o| "

I hope it'll work. What you think about that ? :D

Re: Need some help (AS2).

PostPosted: Fri Mar 08, 2013 9:59 pm
by OwnerOfSuccuby
May be =)))

But if you need all enemy follow player when they are in range it is even simpler =))) All MovieClip object eners frame each time if you do not make them stop or some thing.

So if you will write all code there they can check all automaticly and follow or do not folow player. If you will make a MovieClip object in that enemys and use it like timer it will work too ;)

Re: Need some help (AS2).

PostPosted: Sat Mar 09, 2013 5:03 am
by GoRepeat
Something to chew on since you are already fiddling with arrays; instead of all those type "if" statements, just make a switch function with an array returned to represent those values.

ie- instead of:
Spoiler (click to show/hide):

if(enemyBehavior == "typeA")
{
//define enemy characteristics
tempEnemy_mc.speed = 1
tempEnemy_mc.turnRate = .05
tempEnemy_mc.agroRange = 200;
tempEnemy_mc.mode = "follow"
}
else if(enemyBehavior == "typeB")
{
//define enemy characteristics
tempEnemy_obj.speed = 4
tempEnemy_obj.turnRate = .5
tempEnemy_obj.agroRange = 200;
tempEnemy_obj.mode = "follow"
}
else if(enemyBehavior == "typeC")
{
//define enemy characteristics
tempEnemy_obj.speed = 1
tempEnemy_obj.turnRate = .2
tempEnemy_obj.agroRange = 100;
tempEnemy_obj.mode = "run"
}


use something like this:
Spoiler (click to show/hide):

var typeArray:Array = getType(enemyBehavior);
tempEnemy_mc.speed = typeArray[0];
tempEnemy_mc.turnRate = typeArray[1];
tempEnemy_mc.agroRange = typeArray[2];
tempEnemy_mc.mode = typeArray[3];

function getType(type):Array {
switch(type){
case "typeA": return new Array(4,200,.5,"follow");
case "typeB": return new Array(1,150,.5,"follow");
case "typeC": return new Array(4,200,6,"run");
case "typeD": return new Array(4,200,.5,"follow");
}
}


Makes it much easier to add types in a single line (case E,F,G, etc) and add new variables without adding a ton of more lines. Right now each new type would require 6 lines of code; with the suggested method each new type requires 1.

Some other tips:

never use gotoAndPlay - it is pretty terrible and for some reason causes MASS lag. embed your objects and use "gotoAndStop" using the embedded object's natural looping animation
make a "stage" object for your enemies that you can load and embed code into. This way you can use the "this._parent" logic to issue commands from 'within' the enemy so they all act independantly from each other - because each instance is a different "this"
Once you get the hang of ^ doing the type of stuff you want to do will be extremely simplified as you can have each object handle its own tracking, running, following, and targeting independent of everything else on the stage...

Re: Need some help (AS2).

PostPosted: Sat Mar 09, 2013 11:04 am
by OwnerOfSuccuby
I hear some where that arrays work slower than variables ;) But i do not know is it true or not - and can anybody ever see this difference :mrgreen:

About gotoAndStop() - yes but it is for static objects. But for example if you have to make dinamic object ? I think it s better to make one more gotoAndPlay then make timer in object for example.

But i always make 1 movieClipObject that plays and use it like timer on mane time line - but it is not good solution too some times is realy hard to put all events on one timer. But i think i wil try different ways soon too =)

So balance is very important ;) But yes if you can put some where gotoAndStop() - and do not put gotoAndPlay() - it is really better to use gotoAndStop()