fix: pixel rounding

This commit is contained in:
cha0s 2024-06-12 19:39:40 -05:00
parent b40c80caff
commit 2ad8d492b5
2 changed files with 6 additions and 3 deletions

View File

@ -38,7 +38,10 @@ export default function EcsComponent() {
}
const {Camera} = mainEntity;
const {TileLayers} = ecs.get(1);
const [cx, cy] = [Camera.x - RESOLUTION.x / 2, Camera.y - RESOLUTION.y / 2];
const [cx, cy] = [
Math.round(Camera.x - RESOLUTION.x / 2),
Math.round(Camera.y - RESOLUTION.y / 2),
];
return (
<Container>
<TileLayer

View File

@ -27,8 +27,8 @@ export default function Sprite({entity}) {
return (
<PixiSprite
texture={texture}
x={entity.Position.x}
y={entity.Position.y}
x={Math.round(entity.Position.x)}
y={Math.round(entity.Position.y)}
/>
);
}