Next step in tutorial

This commit is contained in:
Thomas FORGIONE 2015-05-27 16:18:24 +02:00
parent 718e6f88b8
commit 05f47aa5e7
3 changed files with 19 additions and 3 deletions

View File

@ -1,7 +1,8 @@
var Coin = function(x,y,z) { var Coin = function(x,y,z, callback) {
this.ready = false; this.ready = false;
this.got = false; this.got = false;
this.init(x,y,z); this.init(x,y,z);
this.callback = callback;
} }
var _toto = new Audio(); var _toto = new Audio();
@ -41,6 +42,7 @@ Coin.prototype.update = function() {
Coin.prototype.get = function() { Coin.prototype.get = function() {
if (!this.got) { if (!this.got) {
this.got = true; this.got = true;
this.callback();
if (this.mesh) { if (this.mesh) {
this.mesh.visible = false; this.mesh.visible = false;
} }

View File

@ -17,7 +17,11 @@ var TutorialSteps = function(tutoCamera) {
justclick: true 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 justclick: true
} }
]; ];
@ -31,7 +35,15 @@ TutorialSteps.prototype.nextStep = function() {
case 0: break; case 0: break;
case 1: this.camera.allowed.mouseRotate = true; break; case 1: this.camera.allowed.mouseRotate = true; break;
case 2: this.camera.allowed.keyboardRotate = 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++; this.step++;
} }

View File

@ -122,6 +122,8 @@ function init() {
// Add listeners // Add listeners
initListeners(); initListeners();
tutorial.nextStep();
} }
function initListeners() { function initListeners() {