Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions app/lib/icemake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,10 @@ function runGraphExecution(
if (children != null && typeof children !== "number") {
let condition = false;
if (component.type === "if") {
const cond: ConeColor | Flavor | Flavor[] | number =
const cond: ConeColor | Flavor[] | number =
component.condition;
if (typeof cond === "string") {
if (coneColors.includes(cond as ConeColor))
condition = color === cond;
else if (flavors.includes(cond as Flavor))
condition = stack.length > 0 && stack[stack.length - 1] === cond;
condition = color === cond;
} else if (Array.isArray(cond)) {
for (let i = 0; i <= stack.length - cond.length; i++) {
if (
Expand Down
75 changes: 43 additions & 32 deletions app/routes/selectStage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from "react-router";
import { bubbles } from "~/bubbles";

const TOTAL_STAGES = 24;
const TOTAL_STAGES = 20;

const PATH_WIDTH = 1100;
const CENTER_X = PATH_WIDTH / 2;
Expand Down Expand Up @@ -103,58 +103,66 @@ const personDecorations = [
{
src: "/if_false.png",
alt: "If False Character",
top: "50rem",
right: "4rem",
stageIndex: 8,
width: 76,
offsetX: 50,
offsetY: -100,
},
{
src: "/if_true.png",
alt: "If True Character",
top: "47%",
left: "18rem",
stageIndex: 19,
width: 76,
offsetX: 40,
offsetY: -150,
},
{
src: "/pop_vanilla.png",
alt: "Pop Vanilla Character",
top: "37rem",
left: "30rem",
stageIndex: 0,
width: 64,
offsetX: 40,
offsetY: -80,
},
{
src: "/pop_strawberry.png",
alt: "Pop Strawberry Character",
top: "14rem",
right: "4rem",
stageIndex: 16,
width: 64,
offsetX: 40,
offsetY: -120,
},
{
src: "/pop_chocolate.png",
alt: "Pop Chocolate Character",
bottom: "27rem",
left: "35%",
stageIndex: 10,
width: 64,
offsetX: 40,
offsetY: -120,
},
{
src: "/push_vanilla.png",
alt: "Push Vanilla Character",
top: "25rem",
left: "22rem",
stageIndex: 13,
width: 72,
offsetX: 40,
offsetY: -120,
},
{
src: "/push_strawberry.png",
alt: "Push Strawberry Character",
bottom: "45rem",
left: "45%",
stageIndex: 3,
width: 72,
offsetX: 20,
offsetY: -150,
},
{
src: "/push_chocolate.png",
alt: "Push Chocolate Character",
bottom: "37rem",
right: "5rem",
stageIndex: 6,
width: 64,
offsetX: 40,
offsetY: -120,
},
];

Expand Down Expand Up @@ -182,21 +190,6 @@ export default function SelectStage() {
}
/>
))}
{personDecorations.map((decor, index) => (
<img
key={`person-decor-${index}`}
src={decor.src}
alt={decor.alt}
className="pointer-events-none absolute z-0 opacity-90"
style={{
width: decor.width,
top: decor.top,
left: decor.left,
right: decor.right,
bottom: decor.bottom,
}}
/>
))}

{/* Back button */}
<div className="relative z-10 mt-6 w-full px-4">
Expand Down Expand Up @@ -240,6 +233,24 @@ export default function SelectStage() {
/>
</svg>

{personDecorations.map((decor, index) => {
const pos = stagePositions[decor.stageIndex];
return (
<img
key={`person-decor-${index}`}
src={decor.src}
alt={decor.alt}
className="pointer-events-none absolute z-0 opacity-90"
style={{
position: "absolute",
width: decor.width,
left: pos.x + decor.offsetX,
top: pos.y + decor.offsetY,
}}
/>
);
})}

{stagePositions.map((pos, i) => {
const stageNum = i + 1;
return (
Expand Down
7 changes: 0 additions & 7 deletions app/routes/stage.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ function getComponentSrc(
) {
return { src: baseSrc, overlaySrc: `/cone_${condition}.png` };
}
// Flavor
if (
typeof condition === "string" &&
["vanilla", "chocolate", "strawberry"].includes(condition)
) {
return { src: baseSrc, overlaySrc: `/ice_${condition}.png` };
}
// Flavor[]
if (Array.isArray(condition)) {
const overlayImages = condition.map((flavor) => `/ice_${flavor}.png`);
Expand Down
91 changes: 31 additions & 60 deletions app/stages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export type Flavor = "vanilla" | "chocolate" | "strawberry";
export type Component =
| { type: "start" }
| { type: "push"; flavor: Flavor }
| { type: "if"; condition: ConeColor | Flavor | Flavor[] | number }
| { type: "if"; condition: ConeColor | Flavor[] | number }
| { type: "pop"; flavor: Flavor | undefined };
export type StageData = {
mission: Partial<Record<ConeColor, Flavor[]>>;
Expand Down Expand Up @@ -158,69 +158,40 @@ export const STAGES: Record<number, StageData> = {
{type: "if", condition: 5},
]
},
21: {
20: {
mission: {
red: ["chocolate", "vanilla", "strawberry", "chocolate", "vanilla", "strawberry"],
yellow: ["vanilla", "strawberry", "chocolate", "vanilla", "strawberry", "chocolate"],
brown: ["strawberry", "chocolate", "vanilla", "strawberry", "chocolate", "vanilla"],
red: ["vanilla", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry", "chocolate", "vanilla"],
yellow: ["strawberry", "vanilla", "chocolate", "strawberry", "chocolate", "vanilla", "strawberry", "chocolate", "vanilla"],
brown: ["vanilla", "strawberry", "vanilla", "chocolate", "strawberry", "chocolate", "vanilla", "strawberry", "chocolate", "vanilla"],
},
components: [
{ type: "if", condition: "yellow" },
{ type: "if", condition: "red" },
{ type: "if", condition: 6 },
{ type: "if", condition: 7 },
{ type: "push", flavor: "chocolate" },
{ type: "push", flavor: "strawberry" },
{ type: "push", flavor: "vanilla" },
{ type: "pop", flavor: "chocolate" },
{ type: "pop", flavor: "vanilla" },
],
},
22: {
mission: {
red: ["chocolate", "vanilla", "strawberry", "vanilla"],
yellow: ["strawberry", "vanilla", "chocolate", "vanilla"],
},
components: [
{ type: "if", condition: "yellow" },
{ type: "if", condition: 3 },
{ type: "if", condition: ["strawberry", "vanilla"] },
{ type: "push", flavor: "chocolate" },
{ type: "push", flavor: "strawberry" },
{ type: "push", flavor: "vanilla" },
],
},
23: {
mission: {
red: ["chocolate", "vanilla", "chocolate", "strawberry"],
yellow: ["vanilla","strawberry", "chocolate"],
},
components: [
{ type: "if", condition: "red" },
{ type: "if", condition: 3 },
{ type: "if", condition: ["chocolate", "vanilla"] },
{ type: "push", flavor: "chocolate" },
{ type: "push", flavor: "chocolate" },
{ type: "push", flavor: "chocolate" },
{ type: "push", flavor: "strawberry" },
{ type: "push", flavor: "vanilla" },
],
},
24: {
{type: "push", flavor: "vanilla"},
{type: "push", flavor: "chocolate"},
{type: "push", flavor: "vanilla"},
{type: "push", flavor: "chocolate"},
{type: "push", flavor: "strawberry"},
{type: "if", condition: "red"},
{type: "if", condition: "yellow"},
{type: "if", condition: 4},
{type: "if", condition: 8},
]
},
21: {
mission: {
red: ["chocolate", "vanilla", "chocolate", "vanilla", "chocolate", "vanilla", "chocolate", "vanilla", "strawberry"],
yellow: ["vanilla", "vanilla", "vanilla", "vanilla", "vanilla", "vanilla", "vanilla", "strawberry", "strawberry"],
brown: ["vanilla", "chocolate", "vanilla", "vanilla", "chocolate", "vanilla", "vanilla", "chocolate", "vanilla",],
red: ["vanilla", "strawberry", "chocolate", "vanilla", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry"],
yellow: ["chocolate", "vanilla", "strawberry", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry"],
brown: ["strawberry", "chocolate", "vanilla", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry"],
},
components: [
{ type: "if", condition: "red" },
{ type: "if", condition: "brown" },
{ type: "if", condition: 7 },
{ type: "if", condition: 9 },
{ type: "push", flavor: "chocolate" },
{ type: "push", flavor: "strawberry" },
{ type: "push", flavor: "vanilla" },
{ type: "push", flavor: "vanilla" },
],
},
{type: "push", flavor: "vanilla"},
{type: "push", flavor: "chocolate"},
{type: "push", flavor: "strawberry"},
{type: "if", condition: "red"},
{type: "if", condition: "yellow"},
{type: "if", condition: 3},
{type: "if", condition: 4},
{type: "if", condition: 5},
{type: "if", condition: 8},
]
},
};