Skip to content
Merged
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
Binary file modified public/assets/thumbnail1-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/thumbnail1-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/thumbnail1-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail1-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail2-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail2-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail2-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail3-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail3-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail3-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail4-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail4-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail4-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail5-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail5-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail5-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail6-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail6-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/thumbnail6-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $effect(() => {
<div id="container" class="fixed inset-0">
<div class="fixed inset-0 backdrop-blur-xs flex flex-col justify-center">
<div class="flex flex-col gap-5 mb-20 m-10 p-5 bg-yellow-400/85 rounded-lg">
<h1 class="text-center mt-6 mb-2">Shortcut Game</h1>
<h1 class="text-center mt-6 mb-2">Shortcut Puzzle</h1>
<!--TODO: 題名-->
<a class="btn modal-btn text-2xl" href="/game?stage=1-1" bind:this={btn1} tabindex="1"> Start from 1-1 </a>
<a class="btn modal-btn text-2xl" href="/stage-select" bind:this={btn2} tabindex="2"> Stage Select </a>
Expand Down
6 changes: 4 additions & 2 deletions routes/stage-select/params.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { browser } from "$app/environment";
import { replaceState } from "$app/navigation";
import { onMount } from "svelte";

export const MAX_WORLD = 4;
export const MAX_WORLD = 6;
const WORLD_STAGES_MAP = new Map([
[1, 4],
[2, 4],
[3, 4],
[4, 2],
[4, 4],
[5, 4],
[6, 4],
]);

export class SearchParamState {
Expand Down
4 changes: 2 additions & 2 deletions src/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ export function canPlaceMovableObject(cx: Context, x: number, y: number, object:
const positionX = x + i.x;
const positionY = y + i.y;
const target = grid.getBlock(cx, positionX, positionY);
if (target && target !== Block.switch) {
// すでに何かある場合は、ペーストできない
if (target === undefined || (target && target !== Block.switch)) {
// すでに何かある場合or範囲外は、ペーストできない
return false;
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ export class Grid {
}
this.oobFallableSprites = [];
}
getBlock(cx: Context, x: number, y: number): Block | null {
getBlock(cx: Context, x: number, y: number): Block | null | undefined {
const cells = get(cx.state).cells;
if (y < 0 || y >= cells.length) return undefined;
if (x < 0 || x >= cells[y].length) return undefined;
return get(cx.state).cells[y]?.[x]?.block ?? null;
}
// satisfies: every(MovableObject.relativePositions, (pos) => pos.x >= 0)
Expand Down
20 changes: 20 additions & 0 deletions src/stages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ import { world1 } from "./stages/world1.ts";
import { world2 } from "./stages/world2.ts";
import { world3 } from "./stages/world3.ts";
import { world4 } from "./stages/world4.ts";
import { world5 } from "./stages/world5.ts";
import { world6 } from "./stages/world6.ts";

export const stages = new Map<string, StageDefinition>([
["1-1", world1.stage1],
["1-2", world1.stage2],
["1-3", world1.stage3],
["1-4", world1.stage4],
["2-1", world2.stage1],
["2-2", world2.stage2],
["2-3", world2.stage3],
["2-4", world2.stage4],
["1-1", world1.stage1],
["1-2", world1.stage2],
["1-3", world1.stage3],
Expand All @@ -20,4 +30,14 @@ export const stages = new Map<string, StageDefinition>([
["3-4", world3.stage4],
["4-1", world4.stage1],
["4-2", world4.stage2],
["4-3", world4.stage3],
["4-4", world4.stage4],
["5-1", world5.stage1],
["5-2", world5.stage2],
["5-3", world5.stage3],
["5-4", world5.stage4],
["6-1", world6.stage1],
["6-2", world6.stage2],
["6-3", world6.stage3],
["6-4", world6.stage4],
]);
132 changes: 82 additions & 50 deletions src/stages/world1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,90 +5,122 @@ export namespace world1 {
export const stage1: StageDefinition = {
stage: [
"bbbbbbbbbbbbbbbbbb",
".........b........",
".........b......g.",
".........b...bbbbb",
".........m...bbbbb",
"..................",
"..................",
"...............g..",
"............bbbbbb",
"......bbbbbbbbbbbb",
"bbbbbbbbbbbbbbbbbb",
],
isTutorial: true,
isTutorial: false,
initialPlayerX: 1,
initialPlayerY: 5,
initialPlayerY: 6,
inventoryIsInfinite: false,
blockGroups: [],
switchGroups: [],
usage: {
copy: 0,
cut: Number.POSITIVE_INFINITY,
paste: Number.POSITIVE_INFINITY,
},
};
export const stage2: StageDefinition = {
stage: [
"bbbbbbbbbbbbbbbbbb",
"..................",
"...............g..",
"m............bbbbb",
"bb...........bbbbb",
"bb.....m.....bbbbb",
"........b.........",
"........b.........",
"........b.........",
"........b.........",
"........m.......g.",
"bbbbbbbbbbbbbbbbbb",
],
isTutorial: true,
initialPlayerX: 3,
isTutorial: false,
initialPlayerX: 2,
initialPlayerY: 6,
inventoryIsInfinite: false,
blockGroups: [],
switchGroups: [],
usage: {
copy: 0,
cut: Number.POSITIVE_INFINITY,
paste: Number.POSITIVE_INFINITY,
},
};

export const stage3: StageDefinition = {
stage: [
"bbbbbbbbbbbbbbbbbb",
"...b............g.",
"...b....m......bbb",
"...bm..........bbb",
"...bbb.........bbb",
"...mm..........bbb",
"bbbbbbbbbbb....bbb",
"..................",
"..................",
"..................",
"..................",
"..................",
"mmmm............g.",
"bbbbbbbb....bbbbbb",
],
initialPlayerX: 1,
isTutorial: false,
initialPlayerX: 5,
initialPlayerY: 6,
inventoryIsInfinite: false,
blockGroups: [
{
x: 3,
y: 5,
x: 0,
y: 6,
objectId: "1",
},
{
x: 1,
y: 6,
objectId: "1",
},
{
x: 4,
y: 5,
x: 2,
y: 6,
objectId: "1",
},
{
x: 3,
y: 6,
objectId: "1",
},
],
switchGroups: [],
usage: {
copy: 0,
cut: Number.POSITIVE_INFINITY,
paste: Number.POSITIVE_INFINITY,
},
};

export const stage4: StageDefinition = stagePreprocess({
stage: [
"bbbbbbbbbbbbbbbbbbbbbb",
"......................",
"....................g.",
"...................bbb",
"m..................bbb",
"bb.................bbb",
"bb..........m......bbb",
"bb.........mm......bbb",
"bb..bb...bbbbb.....bbb",
"bb..bbb............bbb",
"bb..bbbb..m........bbb",
"bb..bbbbbbbbbbb....bbb",
"bbbbbbbbbbbbbbbbbbbbb",
".....................",
"...g.................",
"bbbbbbbbbb...........",
".....................",
".....................",
"............bbbbbbbbb",
"....m.........m......",
"....mm.......mm......",
"bbbbbbbbbbbbbbbbbbbbb",
],
overlay: [
"bbbbbbbbbbbbbbbbbbbbbb",
"......................",
"....................g.",
"...................bbb",
"1..................bbb",
"bb.................bbb",
"bb..........2......bbb",
"bb...S.....22......bbb",
"bb..bb...bbbbb.....bbb",
"bb..bbb............bbb",
"bb..bbbb..3........bbb",
"bb..bbbbbbbbbbb....bbb",
"bbbbbbbbbbbbbbbbbbbbb",
".....................",
"...g.................",
"bbbbbbbbbb...........",
".....................",
".....................",
"............bbbbbbbbb",
"....1.........2......",
".S..11.......22......",
"bbbbbbbbbbbbbbbbbbbbb",
],
isTutorial: false,
inventoryIsInfinite: false,
usage: {
copy: 0,
cut: Number.POSITIVE_INFINITY,
paste: Number.POSITIVE_INFINITY,
},
});
}
Loading