I`m trying to stop my score/coins going to minus. I have a spawner that spawns 1 coin per click That amount is deducted from say 30 coins -1 = 29 coins until zero but, when it reaches zero it keeps going to -1, -2, -3 etc.. I tried to add some code to "Add Coin Node" so when it reaches zero it stops until coins are back to 0+ The Coin score is from UI label, do I need to call this? Thanks
I checked the API and can't seem to locate the official variable for coins? All we have is addScoreCoin. So would Scorecoin be it?
do not use point or coin for score. use global var its better. you can get coins numbers but you can get global var. in my games i used global var for score. check this game: https://itunes.apple.com/app/tobogganing/id1447892080
yes but there is no code for get coins. you have add a global var, and when u add coin, add same number to global var. coin and global var will be always same number. then u can use this code: If Settings.coins <= 0 Settings.coins == 0
Spoiler: How am i doing so far? Code: var _dict; var _proto; var _debug; var _coin; var _settings.coins = 0; function init(){ try { _coin = Settings.coins(0); _debug = this.attribute('Debug'); _dict = {}; _proto = Object.getPrototypeOf(this) _proto.setValue = function(name, value) { if(_debug) { log("GlobalsManager:setValue - Name: " + name + ", Value: " + value); } _dict[name] = value; } _proto.getValue = function(name) { let ret = _dict[name]; if(_debug) { log("GlobalsManager:getValue - Name: " + name + ", Returning: " + ret); } return ret; } _proto.dump = function() { for(var key in _dict) { var value = _dict[key]; log("GlobalsManager:debug - Name: " + key + ", Value: " + value); } } } catch(e) { log("SetupError: " + e); } } function update(dt){ } function signal(name, value){ if(_settings.coins <= 0){ _settings.coins == 0; } }