9 Replies Latest reply on Nov 8, 2017 2:59 AM by Jeffrey K.

    Animate CC gotoAndStop for HTML5 Canvas

    digauss

      I'm trying to create a simple plant collecting game. When you click all the plants, game ends and sends you to third frame. 1st frame, start button (just wrote start, didn't try to add navigation yet) 2st frame, game area. 3st frame, game over text. When I start the animation, it passes through 1st frame and comes to second. I've written "stop()" at top of this frame so we can play now.

       

      var kalanMeyve = 7;

      // this fruit instance, click event, bind same function but remove yourself (this.instance)

      this.ananas.addEventListener("click", fl_MouseClickHandler.bind(this.ananas));   

      this.armut.addEventListener("click", fl_MouseClickHandler.bind(this.armut));   

      this.cilek.addEventListener("click", fl_MouseClickHandler.bind(this.cilek));   

      this.domates.addEventListener("click", fl_MouseClickHandler.bind(this.domates));   

      this.kirmizibiber.addEventListener("click", fl_MouseClickHandler.bind(this.kirmizibiber));   

      this.muz.addEventListener("click", fl_MouseClickHandler.bind(this.muz));   

      this.sogan.addEventListener("click", fl_MouseClickHandler.bind(this.sogan));   

      function fl_MouseClickHandler() {       

      this.parent.removeChild(this);       

      kalanMeyve--;     

        if(kalanMeyve == 0)       

      {           

      //alert here works when game over       

      }   

      }

       

      All instances, variables etc. are correct. In fact, when I try to check if my if statement working, it works. I can put an alert when the game is over. But can't navigate to another frame.