Tuesday, 16 January 2018

Animate CC -flappyBird -Part6

In this section you add script for ...
Follow the tutorial

http://blogs.adobe.com/animate/part-6-building-a-html5-flappy-bird-game-clone-with-adobe-animate-cc/















my issue
with undefined instance - in UI class

I changed the following form 'this' to 'exportRoot'
function UI()
{
this.scoreLabel = exportRoot.score;
this.gameOverPrompt = exportRoot.gameOverPrompt;
this.getReadyPrompt = exportRoot.getReadyPrompt;
this.anyKeyPrompt = exportRoot.anyKeyPrompt;
this.screenFlash = exportRoot.ScreenFlash;
this.getReady();
}

UI.prototype.updateScore = function(score)
{
this.scoreLabel.text = score;
}

UI.prototype.getReady = function()
{    
this.gameOverPrompt.visible = false;
    this.getReadyPrompt.visible = true;
exportRoot.startInstructions.visible = true;
exportRoot.screenFlash.visible = false;
}

UI.prototype.gameStart = function()
{
    this.updateScore(0);
this.gameOverPrompt.visible = false;
    this.getReadyPrompt.visible = false;
    exportRoot.startInstructions.visible = false;
    exportRoot.screenFlash.visible = false;

}

UI.prototype.gameOver = function()
{
  this.gameOverPrompt.visible = true;
  this.getReadyPrompt.visible = false;
  exportRoot.startInstructions.visible = true;
}

UI.prototype.triggerScreenFlash = function()
{
  exportRoot.screenFlash.visible = true;
  exportRoot.screenFlash.alpha = 1;
  createjs.Tween.get(exportRoot.screenFlash).to({alpha:0}, 100);

}

1 comment:

  1. An easier way is to replace both "anyKeyPrompt"s with "startInstuctions".
    "anyKeyPrompt" is never actually used.

    ReplyDelete

Exit Interview

Exit Interview You have reached the end of the course.  Some assignments you may have enjoyed while others ... Question 1: Which assig...