Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 7879 times)
0 Members and 1 Guest are viewing this topic.
Offline masteryoom

JGO Coder


Medals: 5
Projects: 2


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


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

I already do that (except without the jardesc  Grin)

Smiley
Offline Phased
« Reply #31 - Posted 2012-11-10 06: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: 2


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


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

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

Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline actual

JGO Coder


Medals: 24



« Reply #33 - Posted 2012-11-10 16: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
« Reply #34 - Posted 2012-11-10 19: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 Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #35 - Posted 2012-11-10 19: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 19:50:41 »

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

Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #37 - Posted 2012-11-10 20:26:00 »

Ascii graphics Smiley
Offline actual

JGO Coder


Medals: 24



« Reply #38 - Posted 2012-11-10 20: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);




Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #39 - Posted 2012-11-10 20: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?

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #40 - Posted 2012-11-10 20: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.

Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #41 - Posted 2012-11-10 20: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!

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Rorkien
« Reply #42 - Posted 2012-11-10 20: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 06: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.

 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (50 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (57 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!