• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED]Help setting up money system

S

shango46

Guest
I am trying to make a clicker game where one button makes the item and then one button sells the item. My problem is that I don't know how to make the one button stop selling when it reaches 0 items to sell. My code for the selling of the item as of right now looks like this in game maker:

///Sell items
global.money+=global.PC
global.items-=global.PC

It works to subtract per click, but once it reaches 0, it keeps going in to negatives. I am very new to this so forgive my asking probably simple questions.
 
S

shango46

Guest
I figured it out. The best way I found is:

//Sell items

global.money+=global.PC * (global.items > 0)

global.items-=global.PC * (global.items > 0)
 
Top