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 07:35 PM.
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 }
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?
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?
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?