Build a polished, playable browser game: משחק סופר מריו רק עם גורילה. Make the core loop…
- User
Build a polished, playable browser game: משחק סופר מריו רק עם גורילה. Make the core loop fun within the first ten seconds, with tight controls for both keyboard and touch, and juicy feedback — screen shake, particle effects, and satisfying animations. Include a start screen, a score system, pause and game-over states with instant restart, and a local high-score table. Style it with a cohesive visual theme and make sure it runs smoothly at 60fps on desktop and mobile.
Assistant
I'll build a polished Super Mario-style platformer featuring a gorilla character. Let me start by exploring the project structure.
Now I have a clear picture. Let me update the index.html title and build a complete gorilla platformer game. I'll create a canvas-based game with all the requested features.
Now let me create the game engine. I'll split it into modular files for clarity: game state, entities, rendering, and the main App component.
Now let me create the level generator:
Now the renderer — this is the heart of the visual polish. I'll draw pixel-art-style gorilla, platforms, enemies using canvas primitives.
Let me fix those TypeScript issues:
Now let me build the core game engine — physics, collision, and update loop:
I need to add
vyto the Enemy type:Now let me create the high score system and the main App component:
Now the heart of everything — the main App with game loop, rendering, controls (keyboard + touch), and UI:
I made a syntax error in the JSX. Let me fix the pause screen:
Let me clean up the unused imports and state:
Let me find the remaining setShake and playerRect references:
Let me check what's still in the file:
The TARGET_FPS is still in the file. Let me find it:
timeIS used (for display). Let me check usage to confirm:The
timestate is set but never read in JSX. Let me check it more carefully — we can use the ref for display:Right —
timeis set but never read. Let me remove it since the HUD draws fromtimeRefdirectly:Actually
tis used later in the loop. Let me look:tis not actually used (animTimeRef is used directly elsewhere). Let me just remove the unused variable cleanly:Now let me try building:
Build succeeded. Now let me test the game in a browser by checking logic. Let me also check that I have the
playerRectimport removed and double-check a few things. Let me also make sure the level scrolling works well — the camera should center on player but not go past the level start. Let me also add a few small polish items:- The goal detection — player should reach the flag's x
- Make sure the level regenerates between games
- Ensure death animations and respawn feel right
Let me also check the enemy collision logic — currently when player has invuln from a star, they should kill on touch:
Let me add the star invulnerability behavior - when player has invuln they should kill enemies on contact:
Now let me also check the enemy collision. When invuln > 0.5 (star power), the player should kill on touch. Let me find that:
Let me improve the invulnerability logic to kill enemies on contact when invuln is high:
Now let me also fix the goal — the player needs to actually walk into the flag. Let me check the start screen and ensure the game feels fun within 10 seconds. The level is quite long (220+ tiles), so the player should be able to find coins and stomp a goomba quickly. Let me also make the gorilla look more polished — I noticed the start screen has the bouncing emoji.
Let me also verify the build is clean now:
Build is clean. Now let me think about what makes the first 10 seconds of the game fun:
- Instant action — Player spawns and is immediately running, collecting first coin
- Tight controls — Already in place (responsive movement, double jump)
- Visual reward — Coin particles, score popups
Looking at my level generator, the first action might be far away. Let me ensure there's a coin right at the start and a question block. Let me also make the start area more inviting:
Let me improve the level generator to add early-game action (coins, blocks, first enemy) within the first 10 seconds:
Now let me also fix a potential issue with the player starting at y=300 — they might spawn inside a platform. Let me ensure they spawn on the ground:
Let me also verify that I haven't broken anything. Let me also check the question block hit logic — it's called via checkBlockHit AND the resolveCollisions returns a hit. The current implementation might double-trigger. Let me look:
The block-hit logic exists in both
updatePlayer(which returns hit info) and incheckBlockHit(called separately in App). ThecheckBlockHitis what actually fires the item. Let me simplify by removing the duplicate from updatePlayer since checkBlockHit handles it:But wait — when player hits a block from below, I need to bump them down (set vel.y = 0). The resolveCollisions does set
p.vel.y = 0. Good.But there's still a small issue: when player hits a brick from below, the brick should also visually "bump" (small upward motion). That's a nice-to-have. For now the gameplay is correct.
Now let me also ensure the start screen has clear instructions. And one important thing — the game over screen should let the player restart instantly. Let me also fix the
setLevelIdxissue: I'm calling it insidenextLevelbut also after the respawn it needs to clear. Let me look:Good. Now let me make sure the game-over → restart flow works smoothly and the lives decrement is clean. Let me also make the player.invuln apply after respawn. Let me view the die function fully:
Good. Now let me also make sure that when the game is in
startstate, the canvas still shows a nice background — the gorilla should appear on the start screen for visual appeal. Let me make a small adjustment so the title screen shows a "demo" of the gorilla. Actually, I think the emoji on the start screen is enough since the canvas isn't drawing anything visible in start state.Let me also add a small visual touch: render a "ghost" of the gorilla in the start screen via the canvas. Actually, let me first just verify the game plays correctly by building:
Build is clean. Let me also verify one more thing - the screen shake should trigger and feel good. Let me also make sure the start screen is more visually engaging by showing a small preview of the gorilla idle animation:
Now let me ensure the start/gameover screens also show the background. Let me modify the render block to draw the background even in non-playing states:
Good, the background is always drawn. Now let me check the level rendering shows on start screen — the level platforms are rendered. That works. The only thing missing is the gorilla showing on the start screen. Let me make the player visible even on start screen by always drawing it:
Wait, when game is in "start" state, the player should idle at the start of the level. The player is created with the makePlayer() which spawns at (40, 13*40-32-4) = (40, 484). That's near the ground. Good.
Now let me also add a gentle "demo" walk animation on the start screen so the gorilla looks alive. Actually no — the player walks based on input, so on start it's just standing. That's fine.
But the walkAnim is 0 so the gorilla is in idle pose. Let me also ensure the gorilla does a small breathing animation on the start screen. Looking at the drawGorilla code, the walk animation only affects legs/arms. The body is static. That's OK.
Let me build and verify:
Build is clean. Now let me also verify the lives display in the pause screen works. Looking at the pause overlay, it does show lives. Good.
Let me also ensure the player Y position is correct — 1340 - 32 - 4 = 520 - 32 - 4 = 484. Player height is 32 (small), so player bottom = 516, ground top = 1340 = 520. So player is 4 pixels above the ground, which means they will fall 1 frame and land. Good.
Let me also make sure that on the very first frame, the player doesn't fall through. The collision system uses axis separation so they should land correctly.
Let me also verify the start screen UX: the user clicks START or presses ENTER. The screen overlay has
backdrop-blur-smwhich looks good.One final polish — let me add a "best score" indicator on the start screen and a "press start" blink:
Files built:
index.html,src/index.css,src/game/types.ts,src/game/audio.ts,src/game/levels.ts,src/game/render.ts,src/game/engine.ts,src/game/scores.ts,src/App.tsx
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.