Posted: Sat Jun 07, 2008 10:18 am Post subject: helpppppp!!!!
i am making a game for my ISU its a fighting game and when the hero punches the villian the villians points go down once but after that theres n end page that i made that shows up b4 the villians health points hits 0 or is less than 0 so i want mario to keep fighting the villian until the villian's health points are 0 or less than 0 so any1 help please and here's my code so far
public static void marioFightSceneBombMushroomPower(int x, int y, int xP, int yP)
{
//Clear screens.
d.clear();
c.clear();
//Call upon the grid method.
{
grid();
}
//Ask user the first question.
d.setTextBackgroundColor(Color.blue);
d.setTextColor(Color.yellow);
d.println(" Please choose your technique of fighting:");
d.println(" ---------------------------------------------------------------");
d.println(" * Please enter: *");
d.println(" * (1) to punch *");
d.println(" * (2) to kick *");
d.println(" * (3) to use your bomb *");
d.println(" ---------------------------------------------------------------");
d.print(" Please enter your choice now: ");
d.setVisible(true);
f.println("Goomba Health Points: " + goombaHealthPoints);
f.println("Mario Health Points: " + marioHealthPoints);
//Read input.
String input = d.readLine();
//Declare integer.
int fighting=0;
/* Set up 'if' construct with try/catch to determine the
next choice of action for the user.*/
try
{
fighting= Integer.parseInt(input);
}
if(fighting==1)
{
f.clear();
goombaHealthPoints-=health ;
f.println("Goomba Health Points: " + goombaHealthPoints);
f.println("Mario Health Points: " + marioHealthPoints);
c.setVisible(true);
c.println("Hit Enter to Continue");
c.readChar();
goombaFightScene(x, y, xP ,yP);
}
if(fighting==2)
{
f.clear();
goombaHealthPoints=goombaHealthPoints-health;
f.println("Goomba Health Points: " + goombaHealthPoints);
f.println("Mario Health Points: " + marioHealthPoints);
c.setVisible(true);
c.println("Hit Enter to Continue");
c.readChar();
goombaFightScene(x, y, xP ,yP);
}
if(fighting==3)
{
f.clear();
goombaHealthPoints-=health;
f.println("Goomba Health Points: " + goombaHealthPoints);
f.println("Mario Health Points: " + marioHealthPoints);
c.setVisible(true);
c.println("Hit Enter to Continue");
c.readChar();
goombaFightScene(x, y, xP ,yP);
}
if (fighting==-1)
{
//create and close method.
d.close();
c.close();
}
if(-1>fighting||fighting==0||fighting>3)
{
//Call upon invalid entry.
invalidEntry(xP, yP);
//Creating the loop.
marioFightSceneBombMushroomPower(x, y, xP, yP);
}
}//marioFightSceneBombMushroom method
Sponsor Sponsor
Aziz
Posted: Sat Jun 07, 2008 11:29 am Post subject: RE:helpppppp!!!!
1) Sentences are your friend.
2) So are [code] tags
3) And you could try to point out where you think somethings is going wrong
4) Your topic needs a proper title
5) All of the above were posted in the FORUM RULES threads.
I you would've just read the rules, you could get help! Either someone would be likely to help you, or you would come up with the answer in your new found divine knowledge.
Yes, I'lm being an ass. I may look at the code, too, but not until tonight at least.
ahmhum
Posted: Sat Jun 07, 2008 12:00 pm Post subject: Re: helpppppp!!!!
Posted: Sat Jun 07, 2008 2:34 pm Post subject: Re: helpppppp!!!!
Using a while loop, keep looping your game until your villain's hp drops below 0. Once your game exits the loop, have the end page show up.
Java:
//while (0>goombaHealthPoints)
It looks like you were trying this, but be sure to remember that it should be goombaHealthPoints>0, and not the other way around.
ahmhum
Posted: Sat Jun 07, 2008 4:29 pm Post subject: Re: helpppppp!!!!
that did help me thnx
ahmhum
Posted: Sat Jun 07, 2008 10:22 pm Post subject: RE:helpppppp!!!!
ok now i want the question to show up after he punches, kicks, or bombs the villian in the first try so he can do something else again punch, kick or bomb
ahmhum
Posted: Sun Jun 08, 2008 11:34 am Post subject: RE:helpppppp!!!!
any1
ahmhum
Posted: Sun Jun 08, 2008 12:11 pm Post subject: RE:helpppppp!!!!
ok now i want the question to show up after he punches, kicks, or bombs the villian in the first try so he can do something else again punch, kick or bomb int 2nd try and on and on until the villians hp hits 0
Sponsor Sponsor
Saad
Posted: Sun Jun 08, 2008 12:31 pm Post subject: Re: helpppppp!!!!
To remphasize Aziz's points. Follow the rules. There was no need to reply 4 times. People aren't always online, you need to have some patience with your questions.
ahmhum
Posted: Sun Jun 08, 2008 12:41 pm Post subject: RE:helpppppp!!!!
people should reply only when they know the answer
ahmhum
Posted: Sun Jun 08, 2008 12:42 pm Post subject: RE:helpppppp!!!!
not to state the obvious
michaelp
Posted: Sun Jun 08, 2008 1:03 pm Post subject: RE:helpppppp!!!!
And you should not use 2 post to put something that could have easily be put in one.
They are only trying to help you get more and better answers.
And don't triple post.
apomb
Posted: Sun Jun 08, 2008 1:05 pm Post subject: RE:helpppppp!!!!
you just blew my mind ahmhum.
ahmhum
Posted: Sun Jun 08, 2008 4:32 pm Post subject: RE:helpppppp!!!!
ok i would like to apologize for wat i said earlier
i shouldn't have said it, i m truly sorry i hope u all forgive me:)
HellblazerX
Posted: Sun Jun 08, 2008 7:52 pm Post subject: RE:helpppppp!!!!
Just put the portion of code that displays the questions and gets the input from the user inside the loop.