Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  Text Attack!  (Read 3725 times)
0 Members and 1 Guest are viewing this topic.
Offline masteryoom

JGO Coder


Medals: 5
Projects: 3


If you look closely, you might see it turning...


« Reply #30 - Posted 2012-11-10 07:34:08 »

I already do that (except without the jardesc  Grin)

Smiley
Online Phased
« Reply #31 - Posted 2012-11-10 07:34:20 »

You have a huge workspace Tongue I usually have different work spaces for different things XD
Offline masteryoom

JGO Coder


Medals: 5
Projects: 3


If you look closely, you might see it turning...


« Reply #32 - Posted 2012-11-10 09:42:07 »

HAS ANYONE TRIED THE LATEST UPDATE?!!!!!!!!!!!!!!!!!!!!!

Smiley
Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline actual

JGO Coder


Medals: 19



« Reply #33 - Posted 2012-11-10 17:44:23 »

And if none of the input will be case sensitive, you can just do input = input.tolowerCase() when you read the input and then you can just do input.equals("a") and not have to worry about testing either case or ignoring the case in every comparison.
Offline Vladiedoo

Senior Member


Medals: 11



« Reply #34 - Posted 2012-11-10 20:33:16 »

You can replace lines 120-172, 52 lines of code, with this-->
1  
2  
3  
4  
5  
6  
7  
if (playerHealth <= 0) {
   System.out.println("You were defeated by the goblin! Press enter to end the game!");
   input = scanner.nextLine();
   stop = true;
} else {
   System.out.println("Your HP: " + playerHealth);
}


Do not stop formatting your code!
Offline HeroesGraveDev

JGO Wizard


Medals: 62
Projects: 8


Muahahahahahaha...


« Reply #35 - Posted 2012-11-10 20:47:50 »

Played it.
Seems like a good concept. Needs to be expanded more.
You should add graphics instead of just text in a console. It would improve the game massively.

Offline Agro
« Reply #36 - Posted 2012-11-10 20:50:41 »

But then its not much of a text adventures is it? ):<

Offline Jimmt
« Reply #37 - Posted 2012-11-10 21:26:00 »

Ascii graphics Smiley
Offline actual

JGO Coder


Medals: 19



« Reply #38 - Posted 2012-11-10 21:28:09 »

I like text games and I am working on one that primarily uses text input (but may have some graphics). I noticed something about your random number generation that I thought I would point out. Here is your code for generating the random number you use:
1  
2  
3  
   public int randomNumber(){
    keyen = 1 + (int) (Math.random() * 4.0);
       return 0;}


Where keyen is a field within class. The problem is that you are setting keyen inside of the function. What if you want a second random number in your game, for instance to determine whether an attack break's the player's weapon? A better way is to write it like this:

1  
2  
3  
public int randomNumber() {
   return 1 + (int) (Math.random() *4.0);
}


and then call it like this:
1  
keyen = randomNumber();


Now your randomNumber function generates a value that can be assigned to any variable, not k=just keyen. Now you can also do something like keyen2 = randomNumber() and it won't affect keyen. So this is better there's still a problem. What if sometimes you want to get a random number between 1 and 4 and sometimes between 1 and 6? With how you have things right now you would need a new function. Instead, make the maximum value a parameter.

1  
2  
3  
4  
5  
6  
public int randomNumber(int maxValue) {
   return 1 + (int)(Math.random()*(double)maxValue);
}

// later on call it like this
keyen = randomNumber(4);


Now you can have keyen2 = randomNumber(6);




Online matheus23

JGO Wizard


Medals: 71
Projects: 3


You think about my Avatar right now!


« Reply #39 - Posted 2012-11-10 21:30:06 »

Ascii graphics Smiley

The game title already made me think... but (at least in the eclipse console (didn't try it out in the konsole yet)) "\r" and "\b" didn't work :/

Thinking of JCurses now, but it is supposed to be a lib similar to what AWT gives you, but in ascii. This means "Frame", "Window", "Panel", "CheckBox" and things like that... and "Button"...

A bit too high level, isn't it? Or is JCurses also capable of doing something low-level stuff, like colored text and replacing text?

Take a look at my development Blog: http://matheusdev.tumblr.com
Also look at my RPG Ruins of Revenge
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Wizard


Medals: 62
Projects: 8


Muahahahahahaha...


« Reply #40 - Posted 2012-11-10 21:33:22 »

Well, at least don't use the console. I hate having to use command prompt to launch java applications.

Anyway, it doesn't HAVE to be a text game, just change the name to "not-text-attack" Wink.

Either have lots of gameplay, or add graphics. That is my suggetion.

Online matheus23

JGO Wizard


Medals: 71
Projects: 3


You think about my Avatar right now!


« Reply #41 - Posted 2012-11-10 21:34:51 »

Well, at least don't use the console. I hate having to use command prompt to launch java applications.

Anyway, it doesn't HAVE to be a text game, just change the name to "not-text-attack" Wink.

Either have lots of gameplay, or add graphics. That is my suggetion.

Man, this is just much more original if you have so cool colored ascii char chars running around! That's pure joy!

Take a look at my development Blog: http://matheusdev.tumblr.com
Also look at my RPG Ruins of Revenge
Offline Rorkien
« Reply #42 - Posted 2012-11-10 21:35:59 »

Create a static class for your random number generation

I have this simple code you might want to take a look:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class RNG {
   public static Random rand = new Random();
   
   //Gets a random number, from 0 to maxValue. exclusive.
  public static int getRNG(int maxValue) {
      return rand.nextInt(maxValue);
   }
   
   //Gets a random number in range. maxValue is exclusive.
  public static int getRNG(int minValue, int maxValue) {
      return rand.nextInt(maxValue - minValue) + minValue;
   }      
}
Offline Agro
« Reply #43 - Posted 2012-11-11 07:08:13 »

ogawd. When I got Java 7, eclipse got jacked up, so I had to go back to Java 6. Wasn't really interested as to why it happened though. Probably never will be Wink

Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (42 views)
2013-05-17 21:29:12

alaslipknot (51 views)
2013-05-16 21:24:48

gouessej (79 views)
2013-05-16 00:53:38

gouessej (79 views)
2013-05-16 00:17:58

theagentd (88 views)
2013-05-15 15:01:13

theagentd (81 views)
2013-05-15 15:00:54

StreetDoggy (123 views)
2013-05-14 15:56:26

kutucuk (147 views)
2013-05-12 17:10:36

kutucuk (147 views)
2013-05-12 15:36:09

UnluckyDevil (157 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.2 seconds with 20 queries.