Cats-vs-Mice/classes/Throwable.js
2025-05-08 17:40:02 +09:00

32 lines
858 B
JavaScript

import { gameFrame } from '../constants/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.rotationSpeed = 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);
}
}