Skip to content

Commit

Permalink
Adjust zombie offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
delasy committed Oct 21, 2024
1 parent 62736b7 commit 0f02259
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ function getEntityImage(entity: Entity): HTMLImageElement | null {
}

function getEntityOffset(entity: Entity): { x: number; y: number } {
return {
x:
entity.getType() === EntityType.Zombie && entity.getHealth() !== 1
? 8
: 0,
y: 0,
};
switch (entity.getType()) {
case EntityType.Zombie: {
if (entity.getHealth() === 1) {
return { x: -2, y: 0 };
} else {
return { x: 14, y: 0 };
}
}
default: {
return { x: 0, y: 0 };
}
}
}

function getEntityRatio(entity: Entity): { width: number; height: number } {
Expand Down

0 comments on commit 0f02259

Please sign in to comment.