Skip to content

Commit

Permalink
Merge pull request #97 from bymrbanks/main
Browse files Browse the repository at this point in the history
Sprite adjustments
  • Loading branch information
webdevcody authored Oct 19, 2024
2 parents 532c0ed + 932cffb commit ed3c9ef
Show file tree
Hide file tree
Showing 4 changed files with 1,006 additions and 15 deletions.
34 changes: 25 additions & 9 deletions components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export function getCellImage(cell: string) {
src="/entities/zombie_alive_1.svg"
alt="Zombie"
className="w-full h-full"
style={{
width: '100%',
height: '100%',
position: 'relative',
top: '-20px',
left: '4px',
}}
/>
);
}
Expand All @@ -16,31 +23,40 @@ export function getCellImage(cell: string) {
src="/entities/player_alive_1.svg"
alt="Player"
className="w-full h-full"
style={{
position: 'relative',
top: '-20px',
left: '4px',
}}
/>
);
}
if (cell === "R") {
return (
<img src="/entities/rocks.png" alt="Block" className="w-full h-full" />
<img src="/entities/rocks.svg" alt="Block" className="w-full h-full" />
);
}
if (cell === "B") {
return (
<img src="/entities/block.svg" alt="Block" className="w-full h-full" />
<img
src="/entities/block.svg"
alt="Block"
className="w-full h-full"
style={{
position: 'relative',
top: '0px',
left: '0px',
}}
/>
);
}
return null;
}

export function Map({ map, size = 64 }: { map: string[][]; size?: number }) {
return (
<div className="relative">
<img
src="/map.png"
alt="Background Map"
className="absolute inset-0 w-full h-full object-cover opacity-50"
/>
<div className="relative z-10">
<div className="relative" style={{ backgroundImage: 'url(/map_tiles.svg)', backgroundSize: '128px', backgroundPosition: 'bottom left' }}>
<div className="relative z-10 test">
{map.map((row, y) => (
<div key={y} className="flex">
{row.map((cell, x) => (
Expand Down
15 changes: 9 additions & 6 deletions components/Visualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,15 @@ export function Visualizer({

return (
<>
<div className="relative" ref={ref}>
<img
src="/map.png"
alt="Background Map"
className="absolute inset-0 w-full h-full object-cover opacity-50"
/>
<div
className="relative"
ref={ref}
style={{
backgroundImage: "url(/map_tiles.svg)",
backgroundSize: "128px",
backgroundPosition: "bottom left",
}}
>
<div
className="relative z-10"
style={{
Expand Down
56 changes: 56 additions & 0 deletions public/entities/rocks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ed3c9ef

Please sign in to comment.