hello could somebody tell me how to make a variable that stop in a certain number.
Like in a shop where you can’t buy the item if you don’t have more than 10 coins.
And I had been very happy if somebody also could tell me how to make a game save if you hit a button or something.
Hrmmm… Well this is being made from scratch, so be prepared for syntax errors lol:
var minMoney = 10;
var money = 9;
function gainMoney ()
{
money ++;
}
function buy ()
{
var itemName = "potion"
if (money < minMoney)
{
print("You don't have enough money!")// I never use print, and probably got the syntax wrong lol
}
else
{
money -= minMoney;
print("You received the " + itemName + ", and lost " + minMoney + "moneys!")
}
}
If you need help understanding any part of it, just ask me, and I can explain to you exactly what that/those part(s) do, and (possibly) explain it line for line.