How To Reset Global Counter ??

Discussion in 'Buildbox 3.0' started by tonymartz2, Jan 15, 2019.

Tags:
  1. tonymartz2

    tonymartz2 Avid Boxer

    Joined:
    Jun 9, 2016
    Messages:
    172
    Likes Received:
    40
    hey guys, the Global Counter works however I have an issue,
    coins collected on gameplay go back to zero after each game over.
    how do I get Global Counter to also reset? because it currently continues from the last session despite the point score label showing zero at start of game.

    thanks in advance
     
  2. tonymartz2

    tonymartz2 Avid Boxer

    Joined:
    Jun 9, 2016
    Messages:
    172
    Likes Received:
    40
    this is the Global Counter Node, what to change here to get this counter to reset on game over?

    function init(){
    this.emitSignal('Trigger', false);
    }
    function update(dt){
    }
    function signal(name, value){
    if(value){
    let id = this.attribute('Identification');
    if(Settings[id] === undefined){
    Settings[id] = 0;
    }
    log(Settings[id]);
    Settings[id] += 1;
    if(Settings[id] >= this.attribute('Target')){
    Settings[id] = 0;
    this.emitSignal('Trigger', true);
    }
    }
    }
     
  3. menanche

    menanche Boxer

    Joined:
    Nov 1, 2018
    Messages:
    57
    Likes Received:
    21
    Here's the solution.
    https://www.buildbox.com/forum/index.php?threads/reset-global-counter.18114/
     

Share This Page