21 lines
507 B
JavaScript
21 lines
507 B
JavaScript
class Trashbin extends GameObject {
|
|
constructor(x, y) {
|
|
super(x, y);
|
|
this.clickable = true;
|
|
this.acceptsItem = true;
|
|
this.hitbox = new Hitbox(this.x, this.y + 5, Game.TILESIZE, Game.TILESIZE - 5);
|
|
}
|
|
draw() {
|
|
Game.c.drawImage(Assets.trashbin, this.x, this.y);
|
|
}
|
|
passItem(item) {
|
|
if (Game.player.distance(this) < Game.TILESIZE) {
|
|
Assets.sounds.trash.play();
|
|
if (Game.gamestate == "tutorial" && Game.tutorialStep == 30) {
|
|
tutorialStep();
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
} |