summaryrefslogtreecommitdiffstats
path: root/src/model
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-11-11 00:56:22 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-11-11 01:46:08 +0100
commitb83b596b0f79fa1d5b95c462d3fa7171ff221a19 (patch)
tree0601d178aff79a47cade680fc2a193cd67108aca /src/model
parent426b2c37ff72d8de40f716365c8301449acfdfcb (diff)
downloadrpgedit-b83b596b0f79fa1d5b95c462d3fa7171ff221a19.tar
rpgedit-b83b596b0f79fa1d5b95c462d3fa7171ff221a19.zip
Add support for simple periodic sprite animations
Diffstat (limited to 'src/model')
-rw-r--r--src/model/data/entity.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/model/data/entity.ts b/src/model/data/entity.ts
index 3474a38..f52c130 100644
--- a/src/model/data/entity.ts
+++ b/src/model/data/entity.ts
@@ -1,19 +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;
}
}