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.
Use "greater than":
if (game.score > 249) AddInventory(4);
else {DisplayMessage (8); StopDialog();}
OH man I knew it would be something simple! I dont know why I didn't think of that! Thanks ;D
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 ???
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.
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!!!
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!
Well thanks for all the concern but I figured it all out already ;D! I just used the >=
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.