Rune2006
DragonWorld - Printable Version

+- Rune2006 (http://rune2006.com/forum)
+-- Forum: Other (/forumdisplay.php?fid=14)
+--- Forum: Gaming (/forumdisplay.php?fid=17)
+--- Thread: DragonWorld (/showthread.php?tid=10)

Pages: 1 2 3


DragonWorld - dsun - 03-19-2013 04:20 AM

A little text based game made by me!

http://dsunscape.webs.com/apps/forums/topics/show/8615132-dragonworld

Perhaps give it a try if you're into text-based rpg? Tongue



If you tried it out, and would like to learn how to make a text game in Java, improve it or whatever, let me know! (it's very easy since it's only basic stuff Smile)



[Image: 2ks9S]


[Image: 2krUn]


[Image: 2ks7v]


[Image: 2ks2l]


[Image: 2ks1y]


[Image: 2kscz]


[Image: 2ksea]


Running on henning's linux:
[Image: rsz_screenshotpct20frompct202013-03-19pc...ct3a43.png]


RE: DragonWorld - Sully - 03-19-2013 04:22 AM

Sure man, let's see how good you're at this kind of stuff C:


RE: DragonWorld - Yogosun - 03-19-2013 04:23 AM

Why not Smile


RE: DragonWorld - Rarity - 03-19-2013 06:41 PM

Why don't I die at 0 health? Does it have to go negative?


RE: DragonWorld - Henning B - 03-19-2013 06:54 PM

(03-19-2013 06:41 PM)Rarity Wrote:  Why don't I die at 0 health? Does it have to go negative?

I dont know, never played it...


RE: DragonWorld - dsun - 03-19-2013 07:45 PM

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


RE: DragonWorld - Henning B - 03-19-2013 08:55 PM

(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


RE: DragonWorld - dsun - 03-19-2013 09:06 PM

awesome man Smile


RE: DragonWorld - Rarity - 03-19-2013 10:58 PM

Yeah, I don't understand Java. I got the logic though Smile


RE: DragonWorld - Doyoy - 08-23-2013 11:25 AM

(03-19-2013 10:58 PM)Rarity Wrote:  Yeah, I don't understand Java. I got the logic though Smile

THEN WHY THE HELL ARE YOU A JAVA CODER OMG OMGOMG SOMEONE HELP ME GOD I'M CRYING!