Forum Topic: Dupe to _root from inside movieclip

(273 views • 11 replies)

This topic is 1 page long.

<< < > >>
None

WolfAkela

Reply To Post Reply & Quote

Posted at: 6/4/07 08:46 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,331

So the duplicate lines goes like this:
duplicateMovieClip(mcPistol_Bullet, "Pistol_bullet"+count_Pistol, count_Pistol);

It's on the timeline inside a movieclip, and mcPistol_Bullet is in there too. Is it possible to put the duplicated movieclip to _root?

And about my other topic, will get back there later. Just want to fix this.

None

RyanPridgeon

Reply To Post Reply & Quote

Posted at: 6/4/07 09:12 AM

RyanPridgeon LIGHT LEVEL 11

Sign-Up: 12/07/05

Posts: 1,985

No, you'd have to do attachMovie which is similar.

I make flashes because I can.
PM me for anything flash or web related or visit my blog here on NG!
Also, here's my DICK

BBS Signature

None

WolfAkela

Reply To Post Reply & Quote

Posted at: 6/4/07 09:17 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,331

Well, the parameters look the same. How would it ensure that the attached/duplicated movie clip will be on the _root?


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 6/4/07 10:20 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,477

You apply it to it. They are not the same, it uses library linkage instead of an existing item.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

ninjitsuwarrior

Reply To Post Reply & Quote

Posted at: 6/4/07 10:44 AM

ninjitsuwarrior FAB LEVEL 24

Sign-Up: 04/28/06

Posts: 1,088

You can make it on the stage:
duplicateMovieClip(mc.pistol_bullet,blablabla )


None

WolfAkela

Reply To Post Reply & Quote

Posted at: 6/5/07 03:52 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,331

There's a problem if I make it on the stage. I want the initial _x and _y of the bullet to be at the point of the gun, which is inside the rotating arm, inside the shooting animation, inside the hero. >_>

And plus, the _x and _y values of the handgun is not equal when I use them for the _root. The coordinates of an MC is from the reference point, while the coordinates of _root is from the top left, so I'm so screwed! :(


None

WolfAkela

Reply To Post Reply & Quote

Posted at: 6/5/07 09:09 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,331

*checks it up on AS2 dictionary*

I think this is EXACTLY what I needed, omg. You're my hero! :D


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 6/5/07 09:38 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,477

Heard of addition? If x is 3 to the right relative to 5, its absolute value is 8.
-_-

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

WolfAkela

Reply To Post Reply & Quote

Posted at: 6/5/07 10:09 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,331

I wanted to simplify things. >_> And I didn't get what you said.


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 6/5/07 10:31 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,477

Simplify addition. Hmm.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Paranoia

Reply To Post Reply & Quote

Posted at: 6/5/07 10:32 AM

Paranoia DARK LEVEL 34

Sign-Up: 04/22/05

Posts: 9,699

Getting relative values for _x and _y is easy. Just do _x + _parent._x, or _x - object._x if you're working backwards, and you're set.

BBS Signature

None

WolfAkela

Reply To Post Reply & Quote

Posted at: 6/10/07 12:40 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,331

Ok, I STILL can't solve problem. I tried using localToGlobal, but it just won't work. The Handgun is contained inside the Arm, which is what I rotate while aiming. Trouble is, the _x value of Handgun DOESN'T change when I rotate the Arm, so the _x and _y values remain the same. :(

Am I really screwed all over

Link: http://denvish.net/ulf/100607/45432_Horror_Sh oot.php

Code for bullet:
onClipEvent (load) {
something = new Object();
something.x = _root.mcPlayer.mcPlayer_HandgunAim.mcHandgunA im_Arm.mcHandgun._x;
something.y = _root.mcPlayer.mcPlayer_HandgunAim.mcHandgunA im_Arm.mcHandgun._y;
something._rotation = _root.mcPlayer.mcPlayer_HandgunAim.mcHandgunA im_Arm.mcHandgun._rotation;
localToGlobal(something);

if (_name == "mcPistol_Bullet") {
_visible = false;
}

spd = 20;
this._x = something._x;;
this._y = something._y;
this._rotation = something._rotation + 50;
}

controls:
Hold J to Aim, K to Shoot.


All times are Eastern Standard Time (GMT -5) | Current Time: 05:03 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!