Cats-vs-Mice/Throwable.js
2025-05-06 23:13:43 +09:00

31 lines
807 B
JavaScript

import { gameFrame } from "./prototype.js";
import { imageAssets } from "./sketch.js";
export class Throwable {
constructor(x, y, point, img, width) {
this.sprite = createSprite(x, y, width, width);
this.sprite.image = img;
// TODO: check on the scale again
this.sprite.scale = gameFrame.tileWidth / 1024;
this.sprite.vel.x = 1;
this.sprite.life = 600;
this.point = point;
this.width = width;
}
remove() {
this.sprite.remove();
}
}
export class Yarn extends Throwable {
constructor(x, y) {
super(x, y, 15, imageAssets.yarn, gameFrame.tileWidth / 4);
}
}
export class Snowball extends Throwable {
constructor(x, y) {
super(x, y, 20, imageAssets.snowball, gameFrame.tileWidth / 4);
}
}