MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / actionInterval

Method actionInterval

code/main/Dragon.ts:55–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53
54 // Private methods
55 private actionInterval(): void{
56 // Do something different depending on the step
57 switch(this.step){
58 case DragonStep.PLAYER_MOVING:
59 // Move the player
60 this.playerPos += 1;
61 if(this.playerPos >= 60){ // If we made it to the dragon
62 // We're now attacking
63 this.step = DragonStep.PLAYER_ATTACKING;
64 // Set the countdown
65 this.playerAttackingCountdown = 40;
66 }
67 // Update
68 this.update();
69 this.getGame().updatePlace();
70 break;
71 case DragonStep.PLAYER_ATTACKING:
72 // Lower the countdown
73 this.playerAttackingCountdown -= 1;
74 if(this.playerAttackingCountdown < 0){ // If it's time to stop attacking
75 // We're now "stop tickling"
76 this.step = DragonStep.STOP_TICKLING;
77 }
78 // Update
79 this.update();
80 this.getGame().updatePlace();
81 break;
82 }
83 }
84
85 private chooseCandies(): void{
86 // Change the step

Callers

nothing calls this directly

Calls 3

updateMethod · 0.95
updatePlaceMethod · 0.80
getGameMethod · 0.45

Tested by

no test coverage detected