Be a Supporter!

little help

  • 298 Views
  • 8 Replies
New Topic Respond to this Topic
munn1
munn1
  • Member since: Jul. 8, 2007
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
little help 2009-08-25 20:13:27 Reply

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
Response to little help 2009-08-25 20:54:01 Reply

can somebody help me out please? im stuck here.. =/

CybexALT
CybexALT
  • Member since: Oct. 13, 2005
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to little help 2009-08-26 05:18:40 Reply

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
Response to little help 2009-08-26 05:23:04 Reply

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.
Forum Stats
Member
Level 25
Game Developer
Response to little help 2009-08-26 08:41:38 Reply

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.
Forum Stats
Member
Level 25
Game Developer
Response to little help 2009-08-26 08:43:44 Reply

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
Response to little help 2009-08-26 09:06:51 Reply

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.
Forum Stats
Member
Level 25
Game Developer
Response to little help 2009-08-26 10:54:07 Reply

At 8/26/09 09:06 AM, Saza wrote:
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.

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
Response to little help 2009-08-26 11:10:24 Reply

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