Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 helpppppp!!!!
Index -> Programming, Java -> Java Help
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ahmhum




PostPosted: 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();

//Set integers;
goombaHealthPoints=60;
marioHealthPoints=70;

int health;

//final int SENTINAL=0;

health = (int) (Math.random () * 15) + 1;

//Call upon the health points console.
{
healthPointsConsole();
}

//Call upon the various initial setup methods.
{

backgroundC(x, y);
backgroundD(x, y);
marioVsGoombaTitle();
}

//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);
}

catch (NumberFormatException e)
{
//User selects defaults to invalid entry.
}

//while (0>goombaHealthPoints)

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
Sponsor
sponsor
Aziz




PostPosted: 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




PostPosted: Sat Jun 07, 2008 12:00 pm   Post subject: Re: helpppppp!!!!

ok heres my whole program


MarioChoicesAB.java
 Description:

Download
 Filename:  MarioChoicesAB.java
 Filesize:  37.8 KB
 Downloaded:  133 Time(s)

HellblazerX




PostPosted: 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




PostPosted: Sat Jun 07, 2008 4:29 pm   Post subject: Re: helpppppp!!!!

that did help me thnx
ahmhum




PostPosted: 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




PostPosted: Sun Jun 08, 2008 11:34 am   Post subject: RE:helpppppp!!!!

any1
ahmhum




PostPosted: 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
Sponsor
sponsor
Saad




PostPosted: 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




PostPosted: Sun Jun 08, 2008 12:41 pm   Post subject: RE:helpppppp!!!!

people should reply only when they know the answer
ahmhum




PostPosted: Sun Jun 08, 2008 12:42 pm   Post subject: RE:helpppppp!!!!

not to state the obvious
michaelp




PostPosted: 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




PostPosted: Sun Jun 08, 2008 1:05 pm   Post subject: RE:helpppppp!!!!

you just blew my mind ahmhum.
ahmhum




PostPosted: 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




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 3  [ 31 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: