summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/MapContext.ts19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/control/MapContext.ts b/src/control/MapContext.ts
index 73b3c4d..1660ad4 100644
--- a/src/control/MapContext.ts
+++ b/src/control/MapContext.ts
@@ -13,13 +13,12 @@ import MapView from '../view/MapView';
export default class MapContext {
- view: MapView;
+ private view: MapView;
- entities: EntityPosition[] = [];
- playerEntity: EntityPosition;
+ private entities: EntityPosition[] = [];
+ private playerEntity: EntityPosition;
-
- collision: number[][];
+ private collision: number[][];
constructor(private map: MapData, private inputHandler: InputHandler) {
@@ -63,12 +62,12 @@ export default class MapContext {
return p.x >= 0 && p.x < this.map.width && p.y >= 0 && p.y < this.map.height;
}
- private incCollision(p: Position) {
+ private incCollision(p: Position): void {
if (this.inMap(p))
this.collision[p.x][p.y]++;
}
- private decCollision(p: Position) {
+ private decCollision(p: Position): void {
if (this.inMap(p))
this.collision[p.x][p.y]--;
}
@@ -77,19 +76,19 @@ export default class MapContext {
return (!this.inMap(p)) || (this.collision[p.x][p.y] > 0);
}
- private addEntity(entity: EntityPosition) {
+ private addEntity(entity: EntityPosition): void {
this.entities.push(entity);
this.incCollision(entity.position);
}
- private addTransition(entity: EntityPosition, dest: Position, start: number, dur: number) {
+ private addTransition(entity: EntityPosition, dest: Position, start: number, dur: number): void {
entity.transition = new Transition(start, start+dur, entity.position, dest);
this.incCollision(dest);
}
- private finishTransition(entity: EntityPosition) {
+ private finishTransition(entity: EntityPosition): void {
this.decCollision(entity.position);
entity.position = entity.transition.dest;