55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
class CoffeeTable extends GameObject {
|
|
constructor(x, y) {
|
|
super(x, y);
|
|
this.clickable = true;
|
|
this.hitbox = new Hitbox(this.x, this.y + 5, Game.TILESIZE, Game.TILESIZE - 5);
|
|
}
|
|
draw() {
|
|
Game.c.drawImage(Assets.coffeetable, this.x, this.y);
|
|
}
|
|
click() {
|
|
if (Game.player.distance(this) < Game.TILESIZE) {
|
|
Assets.sounds.player.makeCoffe.play();
|
|
Game.cursor.item = "coffee";
|
|
}
|
|
}
|
|
}
|
|
|
|
class CableTable extends GameObject {
|
|
constructor(x, y) {
|
|
super(x, y);
|
|
this.clickable = true;
|
|
this.hitbox = new Hitbox(this.x, this.y + 5, Game.TILESIZE, Game.TILESIZE - 5);
|
|
}
|
|
draw() {
|
|
Game.c.drawImage(Assets.cabletable, this.x, this.y);
|
|
}
|
|
click() {
|
|
if (Game.player.distance(this) < Game.TILESIZE) {
|
|
Assets.sounds.player.takeCable.play();
|
|
Game.cursor.item = "cable_red";
|
|
}
|
|
}
|
|
}
|
|
|
|
class ShopTable extends GameObject {
|
|
constructor(x, y) {
|
|
super(x, y);
|
|
this.clickable = true;
|
|
this.hitbox = new Hitbox(this.x, this.y + 5, Game.TILESIZE, Game.TILESIZE - 5);
|
|
this.shop = new Shop();
|
|
this.shop.visible = false;
|
|
}
|
|
draw() {
|
|
Game.c.drawImage(Assets.shoptable, this.x, this.y);
|
|
}
|
|
click() {
|
|
if (Game.player.distance(this) < Game.TILESIZE) {
|
|
Assets.sounds.click.play();
|
|
this.shop.visible = true;
|
|
if (Game.gamestate == "tutorial" && Game.tutorialStep == 23) {
|
|
tutorialStep();
|
|
}
|
|
}
|
|
}
|
|
} |