Skip to content

Commit

Permalink
Don't reassign Sprite position in the SpritePool
Browse files Browse the repository at this point in the history
  • Loading branch information
rexim committed Jul 8, 2024
1 parent 8bf42bd commit 6cdb719
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions game.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,15 @@ function pushSprite(imageData: ImageData, position: Vector2, z: number, scale: n
if (spritePool.length >= spritePool.items.length) {
spritePool.items.push({
imageData,
position,
position: position.clone(),
z,
scale,
pdist: 0,
t: 0,
})
} else {
spritePool.items[spritePool.length].imageData = imageData;
spritePool.items[spritePool.length].position = position;
spritePool.items[spritePool.length].position.copy(position);
spritePool.items[spritePool.length].z = z;
spritePool.items[spritePool.length].scale = scale;
spritePool.items[spritePool.length].pdist = 0;
Expand Down

0 comments on commit 6cdb719

Please sign in to comment.