Hi Guys, hoping someone can help me with my 2D game. I have objects on the screen and when touched I would like them to generate a random number 1-100 which will be added to their point score. Can I do this with nodes or will it take some scripting? So passing a random number into the Add Points Node. Thanks -Dean
I got it working. in my object, touch - add points. I changed my points to this and it works fine.. Now in touch it generates a number between 1 and 1000 and adds it to my point score. Code: let callNameReset; let callNameAdd; let arg; let amount; function init() { let pc = this.attribute('Points/Coins'); let lg = this.attribute('Local/Global'); callNameReset = 'reset' + (lg == 'kLocal' ? '' : 'Global') + (pc == 'kCoins' ? 'Coins' : 'Points') callNameAdd = 'addScore' + (pc == 'kCoins' ? 'Coin' : 'Point') let ct = this.attribute('Current/Total'); arg = (ct != 'kCurrent'); //amount = this.attribute('Amount'); } function update(dt){ } function signal(name, value){ if(name == 'Enabled' && value){ amount = Math.random() * 1000; this.scene()[callNameAdd](amount); }else if(name == 'Reset' && value){ this.scene()[callNameReset](arg); } }