Skip to content

Commit be7577b

Browse files
authored
docs: Add a SDF based suika game clone (#2231)
1 parent 52e09af commit be7577b

13 files changed

Lines changed: 1189 additions & 4 deletions

File tree

apps/typegpu-docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@astrojs/starlight-tailwind": "^4.0.1",
2020
"@astrojs/tailwind": "^6.0.2",
2121
"@babel/standalone": "^7.28.6",
22+
"@dimforge/rapier2d-compat": "^0.19.3",
2223
"@loaders.gl/core": "^4.3.4",
2324
"@loaders.gl/obj": "^4.3.4",
2425
"@monaco-editor/react": "^4.7.0",
49.5 KB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { d } from 'typegpu';
2+
3+
export const LEVEL_RADII = [0.12, 0.16, 0.2, 0.24, 0.28, 0.32, 0.36, 0.4, 0.44, 0.48];
4+
export const LEVEL_COUNT = LEVEL_RADII.length;
5+
export const MAX_LEVEL_RADIUS = LEVEL_RADII[LEVEL_COUNT - 1];
6+
7+
export const WALL_DEFS = [
8+
{ cx: 0, cy: -0.5, hw: 0.5, hh: 0.05 },
9+
{ cx: 0.5, cy: 0, hw: 0.05, hh: 0.55 },
10+
{ cx: -0.5, cy: 0, hw: 0.05, hh: 0.55 },
11+
];
12+
13+
export const SCENE_SCALE = 0.75;
14+
export const WALL_COLOR = d.vec3f(0.55, 0.5, 0.45);
15+
export const WALL_ROUNDNESS = 0.035;
16+
export const MIN_RADIUS = 0.001;
17+
export const GHOST_ALPHA = 0.45;
18+
export const SMOOTH_MIN_K = 16.0;
19+
export const SHARP_FACTOR = 2.4;
20+
export const SPEED_BLEND_MAX = 0.5;
21+
22+
export const MERGE_SCORES = Array.from({ length: LEVEL_COUNT }, (_, n) => ((n + 1) * (n + 2)) / 2);
23+
24+
export const MAX_FRUITS = 256;
25+
export const OFFSCREEN = 10;
26+
export const DROP_Y = 0.65;
27+
export const SPAWN_WEIGHTS = [4, 3, 2, 1];
28+
export const SPAWN_WEIGHT_TOTAL = SPAWN_WEIGHTS.reduce((a, b) => a + b, 0);
29+
export const MERGE_DISTANCE_FACTOR = 0.4;
30+
export const PLAYFIELD_HALF_WIDTH = 0.5;
31+
export const SPAWN_COOLDOWN = 0.35;
32+
export const GAME_ASPECT = 1;
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<canvas data-fit-to-container></canvas>
2+
3+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap" />
4+
5+
<style>
6+
#score {
7+
position: absolute;
8+
bottom: 1rem;
9+
left: 50%;
10+
transform: translateX(-50%);
11+
font-family: 'Fredoka One', cursive;
12+
font-size: 2.4rem;
13+
color: white;
14+
text-shadow:
15+
0 3px 0 rgba(0, 0, 0, 0.35),
16+
0 0 12px rgba(255, 220, 100, 0.4);
17+
pointer-events: none;
18+
z-index: 1;
19+
}
20+
21+
#attribution {
22+
opacity: 1;
23+
position: absolute;
24+
bottom: 0.625rem;
25+
left: 0.625rem;
26+
z-index: 2;
27+
background-color: rgba(0, 0, 0, 0.6);
28+
color: white;
29+
padding: 0.5rem 0.75rem;
30+
border-radius: 0.5rem;
31+
user-select: none;
32+
pointer-events: auto;
33+
transition: opacity 0.5s;
34+
font-size: 0.85rem;
35+
line-height: 1.5;
36+
white-space: nowrap;
37+
}
38+
39+
#attribution a {
40+
color: #87ceeb;
41+
text-decoration: none;
42+
}
43+
44+
#attribution a:hover {
45+
text-decoration: underline;
46+
}
47+
</style>
48+
49+
<div id="score">0</div>
50+
51+
<div id="attribution">
52+
Assets by
53+
<a href="https://apps2amigos.itch.io/fruit-game-free-asset-pack" target="_blank">Apps2Amigos</a
54+
><br />
55+
Adapted from
56+
<a href="https://zrghr.itch.io/froots-and-veggies-culinary-pixels" target="_blank">zrghr</a>
57+
</div>

0 commit comments

Comments
 (0)