Based on the code inside the Canvas, here is an extensive breakdown of Claustrophobia, the game embedded in your plugin.
Overview
Claustrophobia is a high-intensity, infinite arcade survival game. It is designed to create a feeling of panic and urgency. The core concept is simple but stressful: you are trapped in a room that is constantly getting smaller, and touching the walls means instant death.
The Objective
Your goal is to survive as long as possible while accumulating a high score. There is no “winning” in the traditional sense—only delaying the inevitable and beating your previous high score.
Core Mechanics & “Fun” Factors
-
The Shrinking Room:
-
The walls of the room constantly close in on the center.
-
Difficulty Ramp: As time passes, the walls shrink faster (
shrinkSpeedincreases every frame). This forces the player to play more aggressively as the game progresses.
-
-
The Drift Physics:
-
The player character does not stop instantly. The code uses “drift” physics (friction and acceleration), making movement feel slippery (like moving on ice).
-
The Challenge: You must counter-steer to stop yourself from sliding into the deadly walls, adding a layer of skill to simple movement.
-
-
Items & Power-ups:
-
Green Orbs (Expanders): These are your lifeline. Collecting one pushes the walls back (
+100size), buying you valuable time. -
Gold Coins: These are purely for score (
+50 points). They often tempt you into dangerous positions.
-
-
Risk vs. Reward:
-
Items spawn randomly. Sometimes a Green Orb will spawn right next to a wall. You have to decide if you have enough control to grab it without sliding into the wall and dying.
-
Controls
The game features a hybrid control scheme to support both desktop and mobile players:
-
Desktop (Keyboard):
-
Movement:
W,A,S,DorArrow Keys. -
Pause: Click the “Pause” button in the top right.
-
Fullscreen: Click the “Fullscreen” button in the top right.
-
Note: The browser default scrolling is disabled for Space/Arrow keys to ensure smooth gameplay.
-
-
Mobile (Touch):
-
Movement: An on-screen D-Pad (Up, Down, Left, Right) appears automatically on touch devices.
-
Tap: Used to interact with UI buttons (Start, Pause, Resume).
-
Level Progression
Technically, the game is one single, infinite level. However, it behaves like a progressive difficulty curve:
-
Early Game: The room is large (760px), and walls shrink slowly (starting speed 0.3). You have plenty of space to maneuver.
-
Mid Game: The room is half-size. The walls are moving faster. You must prioritize Green Orbs over Gold Coins.
-
Late Game (The “Panic” Phase): The room is tiny. The walls are closing in rapidly. You barely have room to drift without hitting a wall. You are essentially dashing from one Green Orb to the next just to keep the room open.
Visuals & Feedback
-
Neon Aesthetic: High-contrast neon colors (Hot Pink walls, Cyan orbs, Gold coins) on a near-black background.
-
Particle Effects: Exploding particle animations occur when you collect items or crash into a wall.
-
HUD: Displays your Score and a “Danger Level” percentage that turns red as the room gets smaller.
