• Login
  • Register
Hello There, Guest!

Username:

Password:

Remember me

hasło Lost Password?

  • Forum
  • Search
  • Member List
  • Play
  • Hiscores
glowna Rune2006 → Other → Gaming v
1 2 Next »
→

DragonWorld


Post Reply
Threaded Mode | Linear Mode
DragonWorld
Henning B
Skeletal Member
  • Posts:538
  • Joined:Mar 2013
  • Reputation:9
03-19-2013 08:55 PM RE: DragonWorld
Post: #7
(03-19-2013 07:45 PM)dsun Wrote:  
(03-19-2013 06:41 PM)Rarity Wrote:  Why don't I die at 0 health? Does it have to go negative?

}else if(hp <= 0){
fight = false;
System.out.println("\nYou died!");
System.out.println("Lost some gold.");
gold *= 0.5;
hp = hpMax;
home();


^as u can see, you should die when you hit 0 or less HP

but the problem is, it's turn based.
the monster first hits you, and then you hit the monster no matter what your hp is.

in other words, if the monster hits you and your hp is 0 or less, you will still attack for the fight to end.
therefore, you may kill the monster while you have 0 hp or less, and still survive. i haven't got to fix this yet.


I just found this code:

}else if(hp <= 0 && m_hp <= 0){
fight = false;
System.out.println("\nYou died!");
System.out.println("Lost some gold.");
gold *= 0.5;
hp = hpMax;
home();

and realized that i put it in the wrong place... (so it wont really do anything, oh well)
what the code basically means, if you and the monster reach 0 or less HP at the same time, you only will die..

i cant fix this now, too much work Big Grin

if you'd like to fix or improve stuff in the game, feel free to do so!
here's the code: pastebin.com/nkTqCjAG


thanks for playing!


If you still couldn't understand the logic, here's more of the code to get a better idea (hopefully you know at least some java Wink):

public static void phoenix() throws InterruptedException{
fight = true;
m_hp = 50;
System.out.println(mons[8]);

while(fight == true){
m_dmg = r.nextInt(5);
goldDrop = 1+r.nextInt(100);
monsterDrop = 1+r.nextInt(15);
heal = 1+r.nextInt(4);
healAmount = 1+r.nextInt(7);
dmg = r.nextInt(str);
dmg *= 0.5;
healSelf = 1+r.nextInt(3);
healSelfAmount = 1+r.nextInt(5);
System.out.println("Phoenix (HP:" + m_hp + "/50) does " + m_dmg + " damage");
if(heal == 1){
System.out.println("+" + healAmount + " heal!");
}
hp -= m_dmg;
System.out.println(name + " (HP:" + hp + "/" + hpMax + ") does " + dmg + " damage");
m_hp -= dmg;
if(phoenixPetEquipped == true && hp < hpMax && healSelf == 1){
System.out.println(healSelfAmount + "+ heal!");
hp += healSelfAmount;
if(hp > hpMax){
hp = hpMax;
}
}
System.out.println();
Thread.sleep(1500);

if(m_hp <= 0){
fight = false;
System.out.println("You killed the phoenix\nGained 100 exp\nDrops:\nGold x" + goldDrop);
if(monsterDrop == 1 && phoenixPet == false){
System.out.println("Phoenix pet");
phoenixPet = true;
}
gold += goldDrop;
exp += 100;
lvlsystem();
}else if(hp <= 0){
fight = false;
System.out.println("\nYou died!");
System.out.println("Lost some gold.");
gold *= 0.5;
hp = hpMax;
home();
}else if(hp <= 0 && m_hp <= 0){
fight = false;
System.out.println("\nYou died!");
System.out.println("Lost some gold.");
gold *= 0.5;
hp = hpMax;
home();
}
}
}

Ill play it, and take a look at the code while playing it, might get to fix some bugs to Big Grin

Best Regards
~Henning B.
Married to Dsun.
[Image: Resubmit.png]
Need Help?

top
find
quote
« Next Oldest | Next Newest »
Post Reply


Messages In This Thread
DragonWorld - dsun - 03-19-2013, 04:20 AM
RE: DragonWorld - Sully - 03-19-2013, 04:22 AM
RE: DragonWorld - Yogosun - 03-19-2013, 04:23 AM
RE: DragonWorld - Rarity - 03-19-2013, 06:41 PM
RE: DragonWorld - Henning B - 03-19-2013, 06:54 PM
RE: DragonWorld - dsun - 03-19-2013, 07:45 PM
RE: DragonWorld - Henning B - 03-19-2013 08:55 PM
RE: DragonWorld - dsun - 03-19-2013, 09:06 PM
RE: DragonWorld - Rarity - 03-19-2013, 10:58 PM
RE: DragonWorld - Doyoy - 08-23-2013, 11:25 AM
RE: DragonWorld - dsun - 08-28-2013, 04:46 AM
RE: DragonWorld - Doyoy - 08-28-2013, 05:01 AM
RE: DragonWorld - Micah - 08-28-2013, 05:21 AM
RE: DragonWorld - Doyoy - 08-28-2013, 09:51 AM
RE: DragonWorld - Jenove - 08-29-2013, 05:41 AM
RE: DragonWorld - Doyoy - 08-31-2013, 01:07 AM
RE: DragonWorld - Doyoy - 01-10-2014, 09:57 AM
RE: DragonWorld - Doyoy - 01-10-2014, 01:47 PM
RE: DragonWorld - Terraforming - 01-10-2014, 03:22 PM
RE: DragonWorld - dsun - 01-10-2014, 04:18 PM
RE: DragonWorld - Terraforming - 01-10-2014, 07:07 PM
RE: DragonWorld - dsun - 03-02-2014, 10:18 AM
RE: DragonWorld - Dri Comics - 03-04-2014, 03:24 PM
RE: DragonWorld - Goku - 03-04-2014, 04:36 PM
RE: DragonWorld - Dri Comics - 03-04-2014, 04:47 PM
RE: DragonWorld - dsun - 03-04-2014, 06:56 PM
RE: DragonWorld - Yogosun - 03-04-2014, 07:32 PM
RE: DragonWorld - Goku - 03-04-2014, 07:52 PM
RE: DragonWorld - Yogosun - 03-04-2014, 08:01 PM
RE: DragonWorld - rsc - 03-04-2014, 07:20 PM

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Index | Return to Top | Lite (Archive) Mode | RSS Syndication

Powered By MyBB, © 2002-2025 MyBB Group.
Designed by Adrian/Reksio 54ceebe7a40ef32df34f37c2065d4490