Skip to content

Commit

Permalink
fix(client): item bopping bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Veradictus committed Jul 18, 2023
1 parent f80d5f1 commit ebaaff4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/client/src/entity/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default abstract class Entity {

public animation!: Animation | null;

public offsetY = 0; // Used for manually offsetting the entity itself.
public shadowOffsetY = 0;
public hidden = false;

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/entity/objects/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class Item extends Entity {

// We use the `onBop` callback to update the sprite's offset.
this.animation?.onBop((bopIndex: number) => {
this.sprite.offsetY = this.originalY - bopIndex;
this.offsetY = this.originalY - bopIndex;
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ export default class Renderer {
entity.sprite.width,
entity.sprite.height,
entity.sprite.offsetX,
entity.sprite.offsetY,
entity.sprite.offsetY + entity.offsetY,
entity.sprite.width,
entity.sprite.height
);
Expand Down

0 comments on commit ebaaff4

Please sign in to comment.