|
@@ -27,7 +27,7 @@ class FoodHuntGame extends Object2D
|
|
|
|
|
|
/** @type {Button} */
|
|
/** @type {Button} */
|
|
this.backButton = null;
|
|
this.backButton = null;
|
|
-
|
|
|
|
|
|
+
|
|
/** @type {FoodHuntPlayer} */
|
|
/** @type {FoodHuntPlayer} */
|
|
this.player = null;
|
|
this.player = null;
|
|
/** @type {FoodHuntTree} */
|
|
/** @type {FoodHuntTree} */
|
|
@@ -38,7 +38,9 @@ class FoodHuntGame extends Object2D
|
|
this.basket = null;
|
|
this.basket = null;
|
|
/** @type {FoodHuntDialogue} */
|
|
/** @type {FoodHuntDialogue} */
|
|
this.dialogue = null;
|
|
this.dialogue = null;
|
|
-
|
|
|
|
|
|
+ /** @type {FoodHuntMobileController} */
|
|
|
|
+ this.mobileController = null;
|
|
|
|
+
|
|
/** @type {Timer} */
|
|
/** @type {Timer} */
|
|
this.initialTimer = null;
|
|
this.initialTimer = null;
|
|
/** @type {Timer} */
|
|
/** @type {Timer} */
|
|
@@ -47,12 +49,12 @@ class FoodHuntGame extends Object2D
|
|
this.fruitsTimer = null;
|
|
this.fruitsTimer = null;
|
|
/** @type {Timer} */
|
|
/** @type {Timer} */
|
|
this.endGameTimer = null;
|
|
this.endGameTimer = null;
|
|
-
|
|
|
|
|
|
+
|
|
/** @type {Boolean} */
|
|
/** @type {Boolean} */
|
|
this.gameStarted = false;
|
|
this.gameStarted = false;
|
|
/** @type {Boolean} */
|
|
/** @type {Boolean} */
|
|
this.gameEnded = false;
|
|
this.gameEnded = false;
|
|
-
|
|
|
|
|
|
+
|
|
/** @type {Number} */
|
|
/** @type {Number} */
|
|
this.points = 0;
|
|
this.points = 0;
|
|
}
|
|
}
|
|
@@ -104,6 +106,13 @@ class FoodHuntGame extends Object2D
|
|
this.endGameTimer = new Timer("EndGametimer", 1, false, true);
|
|
this.endGameTimer = new Timer("EndGametimer", 1, false, true);
|
|
this.endGameTimer.connect("timeout", this, "_onEndGameTimerTimeout");
|
|
this.endGameTimer.connect("timeout", this, "_onEndGameTimerTimeout");
|
|
this.addChild(this.endGameTimer);
|
|
this.addChild(this.endGameTimer);
|
|
|
|
+
|
|
|
|
+ this.mobileController = new FoodHuntMobileController("MobileController");
|
|
|
|
+ this.mobileController.connect("moveLeft", this.player, "_onMobileControllerMoveLeft");
|
|
|
|
+ this.mobileController.connect("stopLeft", this.player, "_onMobileControllerStopLeft");
|
|
|
|
+ this.mobileController.connect("moveRight", this.player, "_onMobileControllerMoveRight");
|
|
|
|
+ this.mobileController.connect("stopRight", this.player, "_onMobileControllerStopRight");
|
|
|
|
+ this.addChild(this.mobileController);
|
|
}
|
|
}
|
|
|
|
|
|
_draw( /** @type {number} */ delta, /** @type {p5.Graphics} */ db)
|
|
_draw( /** @type {number} */ delta, /** @type {p5.Graphics} */ db)
|