core: add Snake using Typescript #7
@ -81,7 +81,7 @@ class SnakeCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
console.log("[LOG] Reset was triggered");
|
console.debug("[TRACE] Reset was triggered");
|
||||||
this.gameover = false;
|
this.gameover = false;
|
||||||
this.foodAte = true;
|
this.foodAte = true;
|
||||||
for (let i = 0; i < this.height; i++) {
|
for (let i = 0; i < this.height; i++) {
|
||||||
@ -105,6 +105,7 @@ class SnakeCore {
|
|||||||
foodRegen() {
|
foodRegen() {
|
||||||
if (!this.foodAte)
|
if (!this.foodAte)
|
||||||
return;
|
return;
|
||||||
|
console.debug("[TRACE] Food reset was triggered");
|
||||||
this.foodAte = false;
|
this.foodAte = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
let tmp = new Point(Math.floor(Math.random() * this.width), Math.floor(Math.random() * this.height));
|
let tmp = new Point(Math.floor(Math.random() * this.width), Math.floor(Math.random() * this.height));
|
||||||
|
Loading…
Reference in New Issue
Block a user