From e2721d4ef63560d8541c311224a80d65d31d6d62 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 7 Jan 2016 18:55:42 +0100 Subject: Set origin to player entity position --- src/control/MapContext.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/control') 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())) -- cgit v1.2.3