Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Akumayo on Sun 29/02/2004 18:56:38

Title: Points as money???
Post by: Akumayo on Sun 29/02/2004 18:56:38
I need to use points for money, like this:
Say you have 3 points, this is displayed as You Have 3 Dollars.  Then you go to the store and buy something:

GiveScore(-2);
AddInventory(4);

This works fine, you are reduced to 1 dollar.  However, if you buy it again you are reduced to -1 dollars.  How can I make it so that you can't buy the item if you don't have enough money???
(I really don't want to use variables for this)
Title: Re:Points as money???
Post by: Pumaman on Sun 29/02/2004 18:59:28
if (game.score >= 2) {
 GiveScore(-2);
 AddInventory(4);
}
else {
 Display("You can't afford it");
}
Title: Re:Points as money???
Post by: on Mon 01/03/2004 02:45:13
But won't that code make it so that you have to have 2 dollars.  Like, if you had four dollars, would it still let you buy???
Title: Re:Points as money???
Post by: Gilbert on Mon 01/03/2004 03:14:14
Yes, notice how CJ used ">=" instead of "==".