0
votes

First, apologies for a probably silly question. I am completely new to ActionScript and don't have the language to find resources on my question.

I am looking to create a game in which numerical values effect outcomes. How would I go about setting a numerical value that changes depending on which option button is chosen, and how would I use this value to determine which ending plays?

For example; a value starting at 0 and a button that increases that value by 1 up to 5 times, then a button to progress to the next screen, which is dependent on the number value. The screen you reach is dependent on the amount of times you clicked the value increasing button.

Please excuse my sloppy explanation. If anybody could answer my question or tell me what keywords I should be using to research this it would be much appreciated.

1

1 Answers

0
votes

I haven't used Flash for like five years, but I'll do what I can. If I understood you correctly, you have two buttons, first one increases your counter value and second one advances to next screen. In this case, if "a next screen" is a frame in Flash timeline, you can do it this way.

1.You create a click handler for the first button and write code that increases your counter. For example

... {
    counter++;
} 

2.You create a second click handler for the second button where you determine which screen you want to show next. Suppose your counter can be anywhere from 0 to 5 and you have six different frames on the Flash timeline (for example 5,10,15,20,25 and 30), each one represents one possible outcome. Then you need to write something like this

... { 
     switch (counter) {
         case 0:
         gotoAndStop(5);
         break;
    // here you repeat these three lines for each possible case and ordering Flash to skip to the desired frame
         case 5:
         gotoAndStop(30);
         break;
    }
}

And since you're new to AS, consider using AS3 instead of AS2. AS3 is way more structured and consistent.