00:00
00:00
Newgrounds Background Image Theme

Mekatov just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

As: Using Duplicated Movie Clips

18,875 Views | 39 Replies
New Topic Respond to this Topic

Response to As: Using Duplicated Movie Clips 2006-12-11 02:31:32


Much later than my last post, and much more advanced questions, but: How do i set the variables of a duped movieclip in _root, from inside a different movie clip? (i'm making enemy bullets, and attempting to make them without using instance names) I tried everything, but it doesnt work. i have this on _root: enbc=1000;
onEnterFrame = function(){
if(enfire == true){
enbc++;
if(enbc>1100){ enbc=1000; }
duplicateMovieClip("enbullet", "eb"+enbc, enbc); //Create dupe bullet
}}

and have this on the bullet:
onClipEvent(enterFrame){
if(this.hitTest(_root.circle) && _root.fox.hurt._currentframe == 1 && !_root.block){
_root.circle.fall = true;
_root.circle.jump = _root.circle.jumpheight;
_root.circle.hold = true;
_root.remhp -= 5;
_root.fox.hurt.play();
this.removeMovieClip();
}
}
onClipEvent (load) {
speed = 25;
//bullet speed
//Move to gun _y
//Point in same direction as gun
}
onClipEvent (enterFrame) {
if (_xscale>0) {
_x += speed;
} else {
_x -= speed;
}
if (_name == "enbullet") {
_x = -1000;
//Move the original bullet MC offstage
}
if (_x>Stage.width || _x<0 || _y<0 || _y>Stage.height) {
//If off-stage, delete the dupe to save CPU
this.removeMovieClip();
}
if (_root.ground.hitTest(_x, _y, true)) {
this.removeMovieClip();
}
}

and this on the enemy for scripts (yes i do set enfire to true on the frame before this):
_root.enfire = false;
_root["eb"+_root.enbc]._x = _parent._x
_root["eb"+_root.enbc]._y= _parent._y;

any help would be appreciated, thanks!


BBS Signature

Response to As: Using Duplicated Movie Clips 2006-12-11 03:21:04


its ok now, i fixed it, so dont bother trying to help


BBS Signature

Response to As: Using Duplicated Movie Clips 2008-02-16 11:30:17


i need help, i'm trying to make something, that when you pick it up, a new one appears somewhere else so you can pick that up and go on for an eternity like that. any suggestions?

Response to As: Using Duplicated Movie Clips 2008-04-14 14:43:28


hm kay i'm confused... i have this code here for a game where a spaceship is avoiding bubbles (usually rocks in space ya know)...

the code on the ship is not important.. yet... its only to go up and down..

but the bubbles have to go from the right to the left with random speed, sizes, damage and a random spawntime..

i put this code on a bubble instance named "bubble" without the quotes:

onClipEvent (load) {
speed = 0;
damage = 0;
//for the primary bubble that doesn't move.
spawn = Math.random()*100;
respawn = 200;
i = 0;
}
onClipEvent (enterFrame) {
spawn++;
_x -= speed;
if (spawn>=respawn) {
i++;
duplicateMovieClip(_root.bubble, "bub"+i, 1000+i);
_root["bub"+i].speed = Math.random()*10;
_root["bub"+i]._xscale = Math.random()*100+10;
_root["bub"+i]._yscale = _root["bub"+i]._xscale;
_root["bub"+i].damage = _root["bub"+i]._xscale;
_root["bub"+i]._y = Math.random()*400+20;
spawn = Math.random()*200;
//sets speed, size, damage and so on
}
_root["bub"+i]._x -_root["bub"+i].speed;
}

Its not working.. the bubbles spawn in a random placeat the y-axis and have random sizes but they're not moving.. this crazy shit bubbles .. ah yeah.. and while they're stucking there on the right side they change their positions at the y axis .. sometimes...

i know i'm posting late but i hope you notice my review and could help me

look how dump they are stuck there on the right side >:(

As: Using Duplicated Movie Clips


Did you know Wampo is a river in south africa?

Unbelieveble :O

Response to As: Using Duplicated Movie Clips 2008-04-30 17:25:01


Awesome thanks a lot Denvish this is just what I needed!! (I thought I could run away from this problem by not learning it, I guess I though wrong; but this is cool just like Algebra)

Response to As: Using Duplicated Movie Clips 2008-05-03 08:02:22


the code is working right already.. (with the bubbles and so on)... so you're not comitted to help me now but thanks if you wanted.


Did you know Wampo is a river in south africa?

Unbelieveble :O

Response to As: Using Duplicated Movie Clips 2008-06-06 09:56:40


now when you duplicate the MC's, Is the original copy's AS transferred into the copies?
If not, how do I tell the copies what to do?

I'm trying to make a turrent (duplicating a bullet instance). The turrent moves, and I'm trying to make it so the bullets fly in the direction the turret faced (turret._rotation).
I don't need help w/ the code, I just wanted to give ya'll an idea of what I'm doing, so u can understand my question better.


Awesome turret game in the making, featuring 85 uniqe turrets: News post

BBS Signature

Response to As: Using Duplicated Movie Clips 2008-07-19 15:47:35


Is it possible to refer to these movie clips outside by using similar code. Say, I have 100 enemies, named enemy 1 - 100, how can I refer to any of those enemies using outside code?


OMG FISH

BBS Signature

Response to As: Using Duplicated Movie Clips 2008-09-23 19:41:19


i want to use this code to just generate a movie clip every .5 of a second at a random location above the canvas. How would the code look if I were to do that?


PM me for a Signature. | Add me on Steam: Sneakers25

Response to As: Using Duplicated Movie Clips 2010-03-25 18:29:13


I need help! I need to make warfare game but im stuck.
This code dont work:
on(press){
for(i=1;i<2;i++){
duplicateMovieClip(_root.soldier, "soldier"+i, 2+i);
_root["soldier"+i]._x=random(100);
}
}
I dont know action script so well. Please help me!!

(Sorry for my bad english. Im Croatian).