Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need help with AS3 script

New Here ,
Aug 08, 2013 Aug 08, 2013

Hey there,

iam making a shell game and found the following code on the web but want to remove one shell so that its 3 shells instead of 4. After removing the myBall = 4 on my own the game wont work right anymore, so sometimes the right shell is not the one it is supposed to be.

Can you help me to remove the myBall = 4 while still keep the logic working?

Pastebin Link

nClipEvent (load) {

    stopped = true;

    myCTR = -1;

    w = 0;

}

onClipEvent (enterFrame) {

    if (myCTR<=_parent.ctr && myCTR>=0) {

        if (stopped) {

            w = Math.ceil((random(60)+1)/10);

            if (w == 1) {

                if (myBall == 1) {

                    myBall = 2;

                } else if (myBall == 2) {

                    myBall = 1;

                }

            } else if (w == 2) {

                if (myBall == 3) {

                    myBall = 4;

                } else if (myBall == 4) {

                    myBall = 3;

                }

            } else if (w == 3) {

                if (myBall == 3) {

                    myBall = 2;

                } else if (myBall == 2) {

                    myBall = 3;

                }

            } else if (w == 4) {

                if (myBall == 3) {

                    myBall = 1;

                } else if (myBall == 1) {

                    myBall = 3;

                }

            } else if (w == 5) {

                if (myBall == 2) {

                    myBall = 4;

                } else if (myBall == 4) {

                    myBall = 2;

                }

            } else if (w == 6) {

                w = random(3)+6;

            }

            gotoAndPlay("f"+String(w));

            myCTR++;

            stopped = false;

        }

    } else if (_parent.ctr>4 && myCTR>_parent.ctr) {

        if (_parent._currentframe != 5) {

            if (w == 1) {

                if (myBall == 1) {

                    myBall = 2;

                } else if (myBall == 2) {

                    myBall = 1;

                }

            } else if (w == 2) {

                if (myBall == 3) {

                    myBall = 4;

                } else if (myBall == 4) {

                    myBall = 3;

                }

            } else if (w == 3) {

                if (myBall == 3) {

                    myBall = 2;

                } else if (myBall == 2) {

                    myBall = 3;

                }

            } else if (w == 4) {

                if (myBall == 3) {

                    myBall = 1;

                } else if (myBall == 1) {

                    myBall = 3;

                }

            } else if (w == 5) {

                if (myBall == 2) {

                    myBall = 4;

                } else if (myBall == 4) {

                    myBall = 2;

                }

            }

            _parent.gotoAndStop(5);

            gotoAndStop("guess");

        }

    }

}

TOPICS
ActionScript
642
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2013 Aug 08, 2013

1. that's not as3 code.

2. that's poorly coded as1/as2 code.

you should rewrite that code in as3.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2013 Aug 08, 2013

ok but i have no clue about coding AS thats why i need help editing what i have so far.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2013 Aug 08, 2013

the adobe forums are good places to get help.  ie, anyone can ask a question and, if there are no files to download and not much code to correct, expect a helpful answer.

but asking someone to do your work for you is not as likely.  you may be lucky and find someone that will that, but you'll need to be patient.

if you don't want to wait, you should hire someone to do your project for you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2013 Aug 08, 2013

Ok so hire someone might be the best solution. thanks for your help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2013 Aug 08, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines