Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ufocoder committed May 9, 2024
1 parent 5864717 commit 177bc3d
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 237 deletions.
4 changes: 3 additions & 1 deletion src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ interface Texture {
width: number;
height: number;
colors: Color[][];
}
}

type Sprite = Texture
6 changes: 3 additions & 3 deletions src/levels/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const level: Level = {
2: "exit",
},
player: {
x: 9.7,
y: 2.01,
angle: 180,
x: 0,
y: 5.5,
angle: 0,
health: 100,
},
enemies: [
Expand Down
2 changes: 0 additions & 2 deletions src/lib/ecs/components/SpriteComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Component } from "src/lib/ecs/Component";

type Sprite = Texture;

export default class SpriteComponent implements Component {
sprite: Sprite;

Expand Down
6 changes: 3 additions & 3 deletions src/lib/ecs/lib/PositionMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export default class PositionMap<T> {
}

public set(x: number, y: number, entity: T) {
this.map.set(y * this.rows + x, entity);
this.map.set(y * this.cols + x, entity);
}

public get(x: number, y: number) {
return this.map.get(y * this.rows + x);
return this.map.get(y * this.cols + x);
}

public has(x: number, y: number) {
return this.map.has(y * this.rows + x);
return this.map.has(y * this.cols + x);
}

public clear() {
Expand Down
Loading

0 comments on commit 177bc3d

Please sign in to comment.