From 05f47aa5e7e1d1f3c21e5b73acd62f5ae232abde Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Wed, 27 May 2015 16:18:24 +0200 Subject: [PATCH] Next step in tutorial --- js/prototype/Coin.js | 4 +++- js/prototype/TutorialSteps.js | 16 ++++++++++++++-- js/prototype/tutorial.js | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/js/prototype/Coin.js b/js/prototype/Coin.js index f2225ca..3e9d0c6 100644 --- a/js/prototype/Coin.js +++ b/js/prototype/Coin.js @@ -1,7 +1,8 @@ -var Coin = function(x,y,z) { +var Coin = function(x,y,z, callback) { this.ready = false; this.got = false; this.init(x,y,z); + this.callback = callback; } var _toto = new Audio(); @@ -41,6 +42,7 @@ Coin.prototype.update = function() { Coin.prototype.get = function() { if (!this.got) { this.got = true; + this.callback(); if (this.mesh) { this.mesh.visible = false; } diff --git a/js/prototype/TutorialSteps.js b/js/prototype/TutorialSteps.js index 4297746..b0e3627 100644 --- a/js/prototype/TutorialSteps.js +++ b/js/prototype/TutorialSteps.js @@ -17,7 +17,11 @@ var TutorialSteps = function(tutoCamera) { justclick: true }, { - text:"Nice !", + text: "Here is a red coin, click on it !", + justclick: false + }, + { + text:"Nice ! You can try to use the keyboard arrows to move the camera", justclick: true } ]; @@ -31,7 +35,15 @@ TutorialSteps.prototype.nextStep = function() { case 0: break; case 1: this.camera.allowed.mouseRotate = true; break; case 2: this.camera.allowed.keyboardRotate = true; break; - case 3: this.camera.allowed.keyboardTranslate = true; break; + case 3: + this.camera.allowed.keyboardRotate = true; + var self = this; + coins.push(new Coin(0.4911245636058468,1.225621525492101,-5.11526684540265, function() { + self.nextStep(); + })); + coins[coins.length-1].addToScene(scene); + break; + case 4: this.camera.allowed.keyboardTranslate = true; break; } this.step++; } diff --git a/js/prototype/tutorial.js b/js/prototype/tutorial.js index d3e1a2e..ab5d26d 100644 --- a/js/prototype/tutorial.js +++ b/js/prototype/tutorial.js @@ -122,6 +122,8 @@ function init() { // Add listeners initListeners(); + + tutorial.nextStep(); } function initListeners() {