This repository has been archived on 2025-04-27. You can view files and clone it, but cannot push or open issues or pull requests.
Servers-Under-Maintenance-G.../classes/Tables.js

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();
}
}
}
}