A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Multiple questions....any help welcome...

  1. #1
    Member
    Join Date
    Jul 2012
    Posts
    71

    Question Multiple questions....any help welcome...

    Back button for menu?
    hello, I'm making a game and in the game there is a menu. I placed the menu on a frame all by itself. The problem i'm having is I'm not sure how to code
    the back button. When the player clicks the back button I would like them to be able to go back to the frame they were just on.
    For example: If I'm in the kitchen and hit Menu, I will be taken to the menu. Once I'm done viewing the menu I will click Back and return back to the kitchen. If I'm in my room and hit Menu, I will be taken to Menu. Once I finish viewing Menu I will be return back to my room.
    I hope what I'm asking is understandable......
    Is my Give button coding correct?
    Code:
    on(release){//when you hit this button
    if (exp = 400) {//and if the exp with that character is greater than or = to 200
    gotoAndPlay("crayongift");//play this frame
    } 
    } on (release) {
    	if (exp < 400){ //if exp does not >= 20
    gotoAndPlay("crayonnogift");//play this frame
    }
    
    }
    The problem I'm having is the Player can still give a character a gift even though their exp with that character is below 400.....
    This is the original code:

    Code:
    on(release){//when you hit this button
    if (exp >= 20) {//and if the exp with that character is greater than or = to 20
    
    
    gotoAndPlay("whateveryounamedyourframe");//play this frame
    } else { //if exp does not >= 20
    gotoAndPlay("whateveryounamedyourframe");//play this frame
    }
    }

    What is wrong with this code?
    Code:
    on(release){
    	if(Styxgoodexp == 0)
    	if (Styxbadexp ==0){
     hp -= 10;
    gotoAndPlay("styxconvo1");  
    }else if(hp<10) {
    gotoAndPlay ("no hp left");
    }
    }
    on (release) {
    	if(Styxgoodexp == 10)
        if (Styxbadexp == 10){
    hp -= 10;
    gotoAndPlay ("styxconvo2");
    }else if(hp<10){
    gotoAndPlay ("no hp left");
    }
    }
    The problem I'm having is once the player goes to the first convo and clicks out back to the character menu they can't click on the chat button anymore.....
    This is the original code:
    Code:
    on(release){
    
    if (exp == 0) {  
    hp -= 10;
    gotoAndPlay("talk 1");  
    }else if(hp<10) {
    gotoAndPlay ("no hp left");
    }else if(exp == 10) {
    hp -= 10;
    gotoAndPlay ("talk 2");
    }else if(hp<10){
    gotoAndPlay ("no hp left");
    I'm trying to make it so that if the player clicks the wrong option in a convo they can still move on the the next convo even though they didn't gain any exp.....
    Last edited by RaynbowzRule; 11-24-2012 at 08:35 PM.

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I can explain it to you right now, but it's easier if you post the .FLA to get more familiar to it.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  3. #3
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    First, fix the first code, you forgot a "=". When you specify variables you use one equal sign myVar=30, but when you use an if statement to compare, you use two equal signs if(myVar==30){
    PHP Code:
    on(release){//when you hit this button
    if (exp == 400) {//and if the exp with that character is greater than or = to 200
    gotoAndPlay("crayongift");//play this frame

    on (release) {
        if (
    exp 400){ //if exp does not >= 20
    gotoAndPlay("crayonnogift");//play this frame
    }


    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  4. #4
    Member
    Join Date
    Jul 2012
    Posts
    71
    ok I made a .fla file for the chat button: http://s000.tinyupload.com/index.php...24602040553381
    and do you need me to make a .fla file for the back button on the menu?

  5. #5
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I found the issue. The button Chat has this
    PHP Code:
    on(release){
    if(
    good == 0)
    if (
    bad ==0){
     
    hp -= 10;
    gotoAndPlay("joe1");  

    And the button Hi has this
    PHP Code:
    on (release){
    good += 10;

    WHen you hit Hi the good increases +=10, and only you can hit Chat if the good is equal to cero.

    You can reset the good when you hit back, on the Chat frame by simply putting good=0; below the stop();

    That's all! Any other issue? Let me know
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  6. #6
    Member
    Join Date
    Jul 2012
    Posts
    71
    Oh wow! Thanks! That solved EVERYTHING

  7. #7
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Any other thing you want to add, or fix on your flash, inbox me or post it here, let me know.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  8. #8
    Member
    Join Date
    Jul 2012
    Posts
    71
    Actually I do have another question: How do I code a button to randomize conversation?
    Like how could I code Joe's chat button (from the .fla I uploaded) to mix up the conversation?

  9. #9
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Explain better. Randomize what? Eg. if the first choices are Blue or red, and the next is Cold or Hot, when coming back to the convo again, the answers are different, let's say Sad or happy?
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  10. #10
    Member
    Join Date
    Jul 2012
    Posts
    71
    Oh sorry
    For example: Jack has 60 convos, if the player clicks on chat those convos will appear in order. If the player leaves and comes back those convos will be mixed up so the first convo may appear last or be in the middle. It's random.
    Does that explain a little better?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center