little help
- munn1
-
munn1
- Member since: Jul. 8, 2007
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
i put this script on my main character that has a shooting attack so i put this script on him to make it so when you defeat all the enemies you have to walk to the next destination by contact with an object called win, but when you shoot, it takes you there because you come in contact with it. i tryed this scriped but then it stopped working, whats wrong with it?
onClipEvent (enterFrame) {
if (this.hitTest(_root.win) && this.atk == 0) {
gotoAndStop("next");
}
- munn1
-
munn1
- Member since: Jul. 8, 2007
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
can somebody help me out please? im stuck here.. =/
- CybexALT
-
CybexALT
- Member since: Oct. 13, 2005
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
Nothings wrong with the code. You'll have to be more specific if you want help. What does the variable atk do, and what is _root.win? Also, what is in frame "next"?
- the1manwiththeplan
-
the1manwiththeplan
- Member since: Jun. 10, 2008
- Offline.
-
- Forum Stats
- Member
- Level 17
- Blank Slate
At 8/25/09 08:54 PM, munn1 wrote: can somebody help me out please? im stuck here.. =/
I think your problem is your shooting attack is just a shooting animation not a character that dynamically duplicates movieclips for bullets this would explain why your character hittests the win movieclip when you shoot a bullet.
or maybe Im wrong how does your shooting work...?
...
- Wolfos
-
Wolfos
- Member since: Jan. 19, 2008
- Offline.
-
- Send Private Message
- Browse All Posts (11,077)
- Block
-
- Forum Stats
- Member
- Level 25
- Game Developer
I always use a double one instead of &&
like this:
if banana = eaten{
if cheese = eaten{
//do stuff
}
} - Wolfos
-
Wolfos
- Member since: Jan. 19, 2008
- Offline.
-
- Send Private Message
- Browse All Posts (11,077)
- Block
-
- Forum Stats
- Member
- Level 25
- Game Developer
here, this should fix it:
onClipEvent (enterFrame) {
if (this.hitTest(_root.win) {
if this.atk == 0) {
play();
}
}
also, next doesnt work, just use play(); and a stop statement on the next frame
- Sam
-
Sam
- Member since: Oct. 1, 2005
- Offline.
-
- Forum Stats
- Moderator
- Level 19
- Programmer
At 8/26/09 08:43 AM, robin1232 wrote: here, this should fix it:
onClipEvent (enterFrame) {
if (this.hitTest(_root.win) {
if this.atk == 0) {
play();
}
}
also, next doesnt work, just use play(); and a stop statement on the next frame
Or nextFrame();
And you can use &&, it depends how you prefer to code and if it helps you organise go for it. And fuck me you bad at opening/closing brackets.
onClipEvent (enterFrame) {
if (this.hitTest(_root.win) && this.atk==0) {
_root.nextFrame();
}
} - Wolfos
-
Wolfos
- Member since: Jan. 19, 2008
- Offline.
-
- Send Private Message
- Browse All Posts (11,077)
- Block
-
- Forum Stats
- Member
- Level 25
- Game Developer
At 8/26/09 09:06 AM, Saza wrote:At 8/26/09 08:43 AM, robin1232 wrote: here, this should fix it:Or nextFrame();
onClipEvent (enterFrame) {
if (this.hitTest(_root.win) {
if this.atk == 0) {
play();
}
}
also, next doesnt work, just use play(); and a stop statement on the next frame
And you can use &&, it depends how you prefer to code and if it helps you organise go for it. And fuck me you bad at opening/closing brackets.
well, I never performed a working && they always came out as syntax errors
and what does "and fuck me you bad at opening/closing brackets" mean?
- Sam
-
Sam
- Member since: Oct. 1, 2005
- Offline.
-
- Forum Stats
- Moderator
- Level 19
- Programmer
It means your posted script has a few opened but not closed brackets.
And I prefer to use && if I'm honest, not sure why, just how I've learnt to code :P

