DragonWorld
|
|
03-19-2013 04:20 AM DragonWorld
Post: #1
A little text based game made by me!
http://dsunscape.webs.com/apps/forums/to...ragonworld Perhaps give it a try if you're into text-based rpg? 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 ) Running on henning's linux: |
top |
|
03-19-2013 04:22 AM RE: DragonWorld
Post: #2
Sure man, let's see how good you're at this kind of stuff C:
|
top |
|
03-19-2013 04:23 AM RE: DragonWorld
Post: #3
Why not
Huge credits to ᴋᴏʀɴsʟɪᴘᴋɴ for signature :3 |
top |
|
03-19-2013 06:41 PM RE: DragonWorld
Post: #4
Why don't I die at 0 health? Does it have to go negative?
|
top |
|
03-19-2013 06:54 PM RE: DragonWorld
Post: #5
(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... |
top |
|
03-19-2013 07:45 PM RE: DragonWorld
Post: #6
(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 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 ): 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(); } } } |
top |
|
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? Ill play it, and take a look at the code while playing it, might get to fix some bugs to |
top |
|
03-19-2013 09:06 PM RE: DragonWorld
Post: #8
awesome man
|
top |
|
03-19-2013 10:58 PM RE: DragonWorld
Post: #9
Yeah, I don't understand Java. I got the logic though
|
top |
|
08-23-2013 11:25 AM RE: DragonWorld
Post: #10
|
top |
« Next Oldest | Next Newest »
|
User(s) browsing this thread: