Skip to content

Commit

Permalink
adding more maps
Browse files Browse the repository at this point in the history
  • Loading branch information
webdevcody committed Oct 18, 2024
1 parent de74819 commit 4072737
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/play/[level]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export default function PlayLevelPage({
</Button>
<Button
onClick={() => handlePlacementModeChange("block")}
disabled={blockCount >= 2}
variant={placementMode === "block" ? "default" : "outline"}
className="h-10"
>
Expand Down
2 changes: 1 addition & 1 deletion app/play/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function PlayPage() {
</CardTitle>
</CardHeader>
<CardContent className="flex-grow flex items-center justify-center">
<GameMap map={map.grid} />
<GameMap map={map.grid} size={52} />
</CardContent>
<CardFooter className="flex justify-around px-3">
<Link href={`/play/${map.level}`} passHref>
Expand Down
8 changes: 6 additions & 2 deletions components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function getCellImage(cell: string) {
return null;
}

export function Map({ map }: { map: string[][] }) {
export function Map({ map, size = 64 }: { map: string[][]; size?: number }) {
return (
<div className="relative">
<img
Expand All @@ -46,7 +46,11 @@ export function Map({ map }: { map: string[][] }) {
{row.map((cell, x) => (
<div
key={x}
className={`size-16 border dark:border-gray-300 border-gray-700 flex items-center justify-center text-2xl bg-transparent`}
style={{
width: `${size}px`,
height: `${size}px`,
}}
className={`border dark:border-gray-300 border-gray-700 flex items-center justify-center text-2xl bg-transparent`}
>
{getCellImage(cell)}
</div>
Expand Down
38 changes: 38 additions & 0 deletions convex/maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,44 @@ const LEVELS = [
["R", " ", " ", " ", " ", "R"],
],
},
{
grid: [
["Z", "R", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", "Z"],
[" ", "Z", " ", " ", " ", " "],
["Z", " ", " ", " ", " ", " "],
],
},
{
grid: [
["Z", " ", " ", "Z", " "],
[" ", " ", " ", "R", " "],
[" ", " ", " ", " ", " "],
[" ", "R", " ", " ", "R"],
[" ", "Z", " ", " ", "Z"],
],
},
{
grid: [
["R", " ", " ", " ", " ", "R"],
[" ", " ", " ", " ", " ", " "],
[" ", "R", " ", " ", "R", " "],
[" ", "R", "R", "R", "R", " "],
["Z", " ", "Z", "Z", " ", "Z"],
[" ", "Z", "R", " ", "Z", " "],
],
},
{
grid: [
["R", " ", " ", "Z", " ", " ", " "],
[" ", " ", "R", " ", " ", "Z", "Z"],
[" ", " ", "R", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", "R", " ", " "],
["Z", " ", " ", " ", "R", " ", " "],
[" ", " ", " ", "Z", " ", " ", "R"],
],
},
];

export const addMap = mutation({
Expand Down

0 comments on commit 4072737

Please sign in to comment.