decla-red/frontend/src/scripts/objects/character-view.ts
2020-10-05 19:07:17 +02:00

19 lines
584 B
TypeScript

import { vec2 } from 'gl-matrix';
import { CharacterBase, CommandExecutors } from 'shared';
import { RenderCommand } from '../commands/types/render';
import { BlobShape } from '../shapes/blob-shape';
export class CharacterView extends CharacterBase {
private shape = new BlobShape();
protected commandExecutors: CommandExecutors = {
[RenderCommand.type]: (c: RenderCommand) => {
this.shape.setCircles([this.head, this.leftFoot, this.rightFoot]);
c.renderer.addDrawable(this.shape);
},
};
public get position(): vec2 {
return this.head.center;
}
}