diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-11-08 22:03:08 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-11-08 22:25:53 +0100 |
commit | 5eae6f29a80cd47e268cb6eaefa96a0ab0a63e54 (patch) | |
tree | 2631f7b3a9d55adc7d07408b30aecb7b714c25be /src/view | |
parent | 40339947d1a2407a6be95fad58215cdaf7d4c2c9 (diff) | |
download | rpgedit-5eae6f29a80cd47e268cb6eaefa96a0ab0a63e54.tar rpgedit-5eae6f29a80cd47e268cb6eaefa96a0ab0a63e54.zip |
Implement more flexible handling of entities and collidables
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/entity.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/view/entity.ts b/src/view/entity.ts index 6241387..421a238 100644 --- a/src/view/entity.ts +++ b/src/view/entity.ts @@ -1,16 +1,16 @@ +import { EntityData } from '../model/data/entity'; import { Renderer } from './renderer/renderer'; import { SpriteView, SpriteViewBuilder } from './sprite'; import { loadImage, mkTexture } from './util/image'; -export async function loadSimpleEntity( +export async function loadEntity( r: Renderer, - sprite: string, - anchor: [number, number] = [0.5, 0.5], + data: EntityData, ): Promise<SpriteView> { - const tile = await loadImage(`resources/sprite/entity/${sprite}.png`); + const tile = await loadImage(`resources/sprite/entity/${data.sprite}.png`); const texture = mkTexture(r.getContext(), tile); - const [x, y] = anchor; + const [x, y] = data.anchor; const builder = new SpriteViewBuilder(r, texture); builder.addSprite([-x, -y, -x + 1, -y + 1], [0, 0, 1, 1]); |