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)
if (game.score >= 2) {
GiveScore(-2);
AddInventory(4);
}
else {
Display("You can't afford it");
}
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???
Yes, notice how CJ used ">=" instead of "==".