diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2016-01-07 18:55:42 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2016-01-07 18:55:42 +0100 |
commit | e2721d4ef63560d8541c311224a80d65d31d6d62 (patch) | |
tree | e42f264408b55a4d6ea086d9cdc8e209745f4c20 /src/control | |
parent | c9d51face0c5cbca38dc9c27379454405a57ade0 (diff) | |
download | rpgedit-e2721d4ef63560d8541c311224a80d65d31d6d62.tar rpgedit-e2721d4ef63560d8541c311224a80d65d31d6d62.zip |
Set origin to player entity position
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/MapContext.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/control/MapContext.ts b/src/control/MapContext.ts index 1e417e7..1c0f1a8 100644 --- a/src/control/MapContext.ts +++ b/src/control/MapContext.ts @@ -18,6 +18,7 @@ export default class MapContext { entities: {[key: string]: EntityPosition} = {}; playerEntity: EntityPosition; + constructor(private map: MapData, private inputHandler: InputHandler) { this.playerEntity = new EntityPosition( new Entity('square'), @@ -27,7 +28,12 @@ export default class MapContext { this.addEntity(this.playerEntity); - this.view = new MapView(map, this.entities, (time: number) => this.updateState(time)); + this.view = new MapView( + map, + this.entities, + () => this.playerEntity, + (time: number) => this.updateState(time) + ); inputHandler.addListener(() => { if (this.updateState(performance.now())) |