Skip to main content
kaylah44671616
Participant
May 16, 2018 4:47 PM UTC
Question

Play a movie clip when player reaches a certain score

I've followed the Adobe Animate HTML5 Canvas Flappy Bird tutorial by Christopher Caleb, and I'm wondering if anyone has a solution for what I'm trying to do.

I want an animation to play when the player reaches a certain score. The animation is in one layer and is a movie clip symbol with an instance name of "animation" which is on frame 3 in the timeline. I got the game to send an alert when the player reaches the score which is set as 2 for now. But, I cannot get the animation to play at that time also.

Here is the code for the function where the player scores a point.

Main.prototype.scoredPoint = function()

{

     if (this.score === 2){

         alert("You win!");

         this.stop();

          this.gotoAndPlay(3);

       

     }

    else{ this.score++;

      this.ui.updateScore(this.score);

    }

  }

If anyone is familiar with this tutorial and has any ideas of what needs to be added/changed throughout the code, help would be much appreciated.

Thank you!

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

kglad
Community Expert
Community Expert
May 16, 2018 4:50 PM UTC

check your scope: what's alert(this) show?

[moved from Adobe Creative Cloud to Adobe Animate CC - General]

Translate