Scoring and Variables

Although I possess little knowledge regarding the Java programming language, I post on my girlfriend's behalf regarding scoring, variables and the like.

She is currently in the process of creating a text based game, which is to a feature a scoring system based on that of lives. I was specifically wondering how to implement such a thing, and if it would be at all possible for you to provide some example code for reference.

I know anint score variable is required to keep track of the player's current score, but little else.

Any help would be much appreciated,

~Bishie

[612 byte] By [Bishiea] at [2007-11-27 0:19:55]
# 1
From the information you have provided, this is what i could only compile.class Game{int score = 0;}
qUesT_foR_knOwLeDgea at 2007-7-11 22:12:22 > top of Java-index,Java Essentials,Java Programming...
# 2

I appreciate the swift response, I have several queries:

1.) My girlfriend抯 project is a text based game as previously mentioned, one which features multiple rooms. Upon entering certain rooms, the player loses a life, how exactly would such a thing be implemented? Also, what classes would be involved? (There are multiple including Game; Room, Score, etc?

2.) Would it be at all possible to associate the above code with the game and it抯 classes, since implementation is proving troublesome?

3.) Is it possible to implement a points system as well as that of lives? For example, the player would receive points upon entering certain rooms, but would lose them upon entering others.

To clarify the above somewhat, we抮e basically looking to introduce a scoring system into the game. We抮e unsure how to implement different aspects including the player抯 lives, the rooms which result in the loss or gain of points and lives etc?br>

Any help would be much appreciated.

Bishiea at 2007-7-11 22:12:22 > top of Java-index,Java Essentials,Java Programming...
# 3

Well, yeah, you COULD do all of that. But your demand for example code is premature. You don't even have a design yet. Step away from the keyboard and resist the urge to code until you have some idea of what you are going to code.

If your only concept of design is that you're going to use an int variable to keep track of the score, then you're going to have trouble coming up with an implementable design. But perhaps I am underestimating you based only on a single forum post. Anyway, design first and code later.

DrClapa at 2007-7-11 22:12:22 > top of Java-index,Java Essentials,Java Programming...
# 4

> I appreciate the swift response, I have several

> queries:

>

> 1.) My girlfriend抯 project is a text based game as

> previously mentioned, one which features multiple

> rooms. Upon entering certain rooms, the player loses

> a life, how exactly would such a thing be

> implemented? Also, what classes would be involved?

> (There are multiple including Game; Room, Score,

> etc?

You can use a Map, where each room corresponds to a value that has to be either added or subtracted upon entry into the room.

> 2.) Would it be at all possible to associate the

> above code with the game and it抯 classes, since

> implementation is proving troublesome?

As Dr just told you, forget the implementation and design the system first.

qUesT_foR_knOwLeDgea at 2007-7-11 22:12:22 > top of Java-index,Java Essentials,Java Programming...
# 5
Also, are you going to use a GUI? Or is this just going to run on the command line?
CaptainMorgan08a at 2007-7-11 22:12:22 > top of Java-index,Java Essentials,Java Programming...