Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-28-2006, 01:04 AM   #1
Asperon
Member
 
Join Date: Sep 2006
Posts: 58
Default duplicateMovieClip problem

Lets say I have two dots...a red and a blue...and I want the red to duplicate and swarm around the blue...and when it touches the blue...is destroyed(I have it move to like _x = 10000) and the blue's size diminishes when touched. When I use the for() loop...it copies the red dots...but they do not act the same..the all follow the blue..but only the origonal red dot has any effect...this is the code I'm using:

Inside of the movie clip blue:

Code:
onClipEvent(enterFrame){
	bSpeed = 3;
	if(Key.isDown(Key.SPACE)){
		bSpeed = 8;
	}
	if(Key.isDown(Key.DOWN)){
		_y += bSpeed;
	}
	if(Key.isDown(Key.LEFT)){
		_x -= bSpeed;
	}
	if(Key.isDown(Key.UP)){
		_y -= bSpeed;
	}
	if(Key.isDown(Key.RIGHT)){
		_x += bSpeed;
	}
}
Inside of the red I have :

Code:
onClipEvent(load){
	this._x = Math.random()*550;
	this._y = Math.random()*400;
}
onClipEvent(enterFrame){
	with(_root.red){
		rSpeed = 4;
		if(this._y > _root.blue._y){
			this._y -= rSpeed;
		}
		if(this._y < _root.blue._y){
			this._y += rSpeed;
		}
		if(this._x > _root.blue._x){
			this._x -= rSpeed;
		}
		if(this._x < _root.blue._x){
			this._x += rSpeed;
		}
		if(_root.blue.hitTest(getBounds(_root).xMax, _y,true)){
			_root.blue._height -= 5;
			_root.blue._width -= 5;
			_root.red._visible = 0;
			_root.red._x = 10000;
		}
		if(_root.blue.hitTest(getBounds(_root).xMin, _y,true)){
			_root.blue._height -= 5;
			_root.blue._width -= 5;
			_root.red._visible = 0;
			_root.red._x = 10000;
		}
		if(_root.blue.hitTest(_x, getBounds(_root).yMax, true)){
			_root.blue._height -= 5;
			_root.blue._width -= 5;
			_root.red._visible = 0;
			_root.red._x = 10000;
		}
		if(_root.blue.hitTest(_x, getBounds(_root).yMin, true)){
			_root.blue._height -= 5;
			_root.blue._width -= 5;
			_root.red._visible = 0;
			_root.red._x = 10000;
		}
	}
}
and on the frame and layer that have the red dot I have:

Code:
for(var i=0;i<10;i++){
	red.duplicateMovieClip("red",i);
}
Can someone tell me why the duplicated red dots wont' affect the blue dot?
Asperon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help With This duplicateMovieClip Problem indagroove001 ActionScript 2.0 1 08-14-2006 07:29 AM
horizontal scrooling problem veebryss Other Flash General Questions 5 11-08-2004 12:47 PM
Right click menu problem fixfix2 ActionScript 2.0 0 11-08-2004 09:50 AM
LoadVars strange problem! Mr-SpOcK ActionScript 2.0 3 10-21-2004 10:34 PM
No loader problem but a loading problem agenba Simple Stuff (Newbies) 1 02-11-2002 06:29 AM


All times are GMT. The time now is 02:43 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.