| 123456789101112131415161718192021222324252627282930313233343536 |
- //**************ninja1 - Mouse Click Event*********************//
- /**
- For the teaching, we want to ask ninjas what we want to happen
- next we need to know when we want it to happen
- and how will we make this happen -- try to ilicit if()
- should only happen IF ninja is visible
- **/
- if($this.visible()){
- //if the ninja is visible, we'll do the following:
- $this.toggleVisible();
- $this.scene.score+=1;
- lblScore.text($this.scene.score);
-
- }
- //*********Scene - initialize when scene starts**************//
- $this.score = 0;
- //following code is pre-populated:
- if($this.scene.state() == "PLAY"){
- var ninjaTime1 = random(3000, 1000)
- createTimer(ninjaTime1, function(){
- ninja_1.toggleVisible();
- });
- var ninjaTime2 = random(3000, 1000)
- createTimer(ninjaTime2, function(){
- ninja_2.toggleVisible();
- });
- var ninjaTime3 = random(3000, 1000)
- createTimer(ninjaTime3, function(){
- ninja_3.toggleVisible();
- });
- var ninjaTime4 = random(3000, 1000)
- createTimer(ninjaTime4, function(){
- ninja_4.toggleVisible();
- });
- }
|