white-zilla
07-10-2009, 03:16 AM
Hello, i have a question regarding movie clips that have their own individual functions that are controlled by the computer.
let me start by explaining what I wish to do:
I want to make 2 different kinds "enemies" spawn at random at random intervals at one of 9 different points at random. At this moment, I have this much working.
What I want to happen once they spawn is for each individual "enemy" to move around in random directions.
My problem:
my "enemies" seem to be of a hive mind. one will spawn and move how I wish. But when another one spawns from the same spot, they will be in the same loop as the other one, so they will both move perfectly parallel to each other.
I have been following this tutorial.
http://www.tutorialhero.com/click-27540-make_a_turret_game_part_2.php
also here is a snippet of my code. I copied and pasted my problem areas. Right now i'm only working with what I have designated at "spawn location 1"
_root.onEnterFrame=function(){
zombiea=[];//string for enemy type a
zombieb=[];
(imagine a function for random genration)
one=({_x:-11,_y:315})//spawn point one
if(place==0){ //this is an integer returned by my random function
zombie1=attachMovie("bad","bad",_root.getNextHighestDepth(),one);
zombiea.push(_root.bad._name);}
zombie1.onEnterFrame=function(){
if(slow==0){
entor=2;
this._x=this._x+entor;}
if(this._x>=78)
{
trace("arrived");
slow=1;
entor=0;
this._x=this._x+entor;
}
}
any help is greatly appreciated :D
let me start by explaining what I wish to do:
I want to make 2 different kinds "enemies" spawn at random at random intervals at one of 9 different points at random. At this moment, I have this much working.
What I want to happen once they spawn is for each individual "enemy" to move around in random directions.
My problem:
my "enemies" seem to be of a hive mind. one will spawn and move how I wish. But when another one spawns from the same spot, they will be in the same loop as the other one, so they will both move perfectly parallel to each other.
I have been following this tutorial.
http://www.tutorialhero.com/click-27540-make_a_turret_game_part_2.php
also here is a snippet of my code. I copied and pasted my problem areas. Right now i'm only working with what I have designated at "spawn location 1"
_root.onEnterFrame=function(){
zombiea=[];//string for enemy type a
zombieb=[];
(imagine a function for random genration)
one=({_x:-11,_y:315})//spawn point one
if(place==0){ //this is an integer returned by my random function
zombie1=attachMovie("bad","bad",_root.getNextHighestDepth(),one);
zombiea.push(_root.bad._name);}
zombie1.onEnterFrame=function(){
if(slow==0){
entor=2;
this._x=this._x+entor;}
if(this._x>=78)
{
trace("arrived");
slow=1;
entor=0;
this._x=this._x+entor;
}
}
any help is greatly appreciated :D