caa-game/src/entities/pointer.js

30 lines
672 B
JavaScript

var asdf = require("asdf-games");
// eslint-disable-next-line no-unused-vars
const { Texture, TileSprite, AnimManager, entity } = asdf;
const texture = new Texture("./res/pointers.png");
// const states = {
// white: 0,
// red: 1
// };
class Pointer extends TileSprite {
constructor(pos) {
super(texture, 8, 8);
this.pos = pos;
this.scale = { x: 2, y: 2 };
this.anims = new AnimManager(this);
this.anims.add("white", [0, 1, 2, 1].map(x => ({ x, y: 0 })), 0.15);
this.anims.add("red", [0, 1, 2, 1].map(x => ({ x, y: 1 })), 0.15);
this.anims.play("white");
}
update(dt) {
super.update(dt);
}
}
module.exports = Pointer;