summaryrefslogtreecommitdiffstats
path: root/src/renderer/runtime/model/data/entity.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer/runtime/model/data/entity.ts')
-rw-r--r--src/renderer/runtime/model/data/entity.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/renderer/runtime/model/data/entity.ts b/src/renderer/runtime/model/data/entity.ts
new file mode 100644
index 0000000..f52c130
--- /dev/null
+++ b/src/renderer/runtime/model/data/entity.ts
@@ -0,0 +1,29 @@
+import { Collision } from './collision';
+
+export interface EntityAnimation {
+ readonly sequence: ReadonlyArray<[number, number]>;
+}
+
+export interface EntityDataInput {
+ readonly sprite: string;
+ readonly anchor?: [number, number];
+ readonly collision?: Collision[];
+ readonly frames?: number;
+ readonly animation?: EntityAnimation;
+}
+
+export class EntityData {
+ public readonly sprite: string;
+ public readonly anchor: [number, number];
+ public readonly collision: Collision[];
+ public readonly frames: number;
+ public readonly animation?: EntityAnimation;
+
+ constructor(input: EntityDataInput) {
+ this.sprite = input.sprite;
+ this.anchor = input.anchor || [0.5, 0.5];
+ this.collision = input.collision || [];
+ this.frames = input.frames || 1;
+ this.animation = input.animation;
+ }
+}