Game Score Problem...

Started by Yo Mama!, Sun 02/05/2004 18:55:11

Previous topic - Next topic

Yo Mama!

I want to make the game score like the players money. I have it all figured out except for the part where you can buy things. How do I get it so that if the player has 250 or more it lets him "buy" something. Here is what I have so far:

if (game.score ==250) AddInventory(4);
else {DisplayMessage (8); StopDialog();}

But that only works if they have exactly 250. If the player is above or below it gives the message that he does not have enough money. There's probably some simple solution that I dont know of or something.

Ben

Use "greater than":

if (game.score > 249) AddInventory(4);
else {DisplayMessage (8); StopDialog();}

Yo Mama!

OH man I knew it would be something simple! I dont know why I didn't think of that! Thanks  ;D

Akumayo

You need to use >= instead of just greater than, otherwise if you have exactly 250, you can't purchase the item, unless of course they need one more dollar for tax ;D ;D wait, was that funny ???
"Power is not a means - it is an end."

Gilbert

Quote from: Akumayo on Sun 02/05/2004 21:41:34
You need to use >= instead of just greater than,

Well, Ben's code was "> 249", so using greater than is okay already. Of course ">=250" may look more readible sometimes.

Akumayo

Nununununo, only using greater than causes the game to think you need a value of "money" that is more than or greater than  250.  So you need to use >= 

Do you get it yet!!!
"Power is not a means - it is an end."

Akumayo

Though >249 may work, it is much more proper and legible to write >= 250, this way the same amount of money will always be recognized, ommiting confusion.

Warning:  Words with strikethroughs may be to complicated for some weaker minds!!!

I
just
love
glows!
"Power is not a means - it is an end."

Yo Mama!

Well thanks for all the concern but I figured it all out already  ;D! I just used the >=

Gilbert

Akamayo: Why argue about using > or >=? They both work and are clear, as long as you can understand your own codes well, it's just left to the programmer himself to decide which to use.

SMF spam blocked by CleanTalk