Another actionscript problem...
- kickassman1
-
kickassman1
- Member since: Feb. 20, 2007
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
Ok basically, I have a major problem, but hopefully by solving this one I can solve the big big big problem...
function CheckForWeapon() {
if (Xen.hitTest("Samurai_Sword") and Xen.crouch) {
removeMovieClip("Samurai_Sword");
Xen.attachMovie("Samurai_Sword","weapon",9);
Xen.gotoAndStop("PickUp");
Xen.pickup = true;
Xen.weaponheld = true;
}
}
Now firstly when Xen crouches over the sword, it should remove the sword, however it doesn't I am hoping someone on these forums can gimme a hand.
Thanks in advance.
- Patcoola
-
Patcoola
- Member since: Mar. 7, 2003
- Offline.
-
- Forum Stats
- Member
- Level 60
- Animator
i dont think there anything wrong with the code, but do mine that object "Samurai_Sword" most have a assigned or positive depth in order for the removeclip function to work with this object.
Website | Blog | Twitter | Deviant Art | Buy T-Shirts & Mugs
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
At 3/9/09 04:10 AM, kickassman1 wrote: function CheckForWeapon() {
if (Xen.hitTest("Samurai_Sword") and Xen.crouch) {
removeMovieClip("Samurai_Sword");
Xen.attachMovie("Samurai_Sword","weapon"
,9);
Xen.gotoAndStop("PickUp");
Xen.pickup = true;
Xen.weaponheld = true;
}
}
The sword actually has the Instance Name "weapon" when you attach it, not "Samurai_Sword". So as far as I can see, you should be using
weapon.removeMovieClip();
rather than
removeMovieClip("Samurai_Sword");
Also, as Patcoola says, if the weapon wasn't attached with AS in the first place, you'll need to do a swapDepths(78910); first to make it accessible for the deletion
- kickassman1
-
kickassman1
- Member since: Feb. 20, 2007
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
But i didn't place the sword inside the stage.
_root.attachMovie("Samurai_Sword","Samurai_Sword",9,{_x:250, _y:300});
And I have made sure that the sword is called Samurai_Sword.
Xen.attack = false;
Xen.step = 7;
Xen.step2 = 5;
Xen.stance = 1;
Xen.crouch = false;
keydown = false;
Xen.pickup = false;
Xen.weaponheld = false;
Xen.movement = false;
Xen.weapon = false;
These are my startup variables. Everything is done inside the frame.
- kickassman1
-
kickassman1
- Member since: Feb. 20, 2007
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
Really not sure. Try
Samurai_Sword.removeMovieClip();


