How adamkjall/javascript-1-hop-top works
This is a browser-based p5 platform-jumping game: the player starts a run, navigates scrolling levels by bouncing on platforms, collects scoring and speed-boost items, and reaches a game-over screen with a local high-score list and replay options. The controller owns runtime orchestration; level generation, physics/collision, entities, and screens provide distinct domain responsibilities. The README is only a starter-template description, so additional capabilities and links here are based on sampled source; unsampled screens and helpers are represented only where the tree supports them.
Main entry points: gameController.ts Game controller · levelFactory.ts Level factory · sketch.ts Sketch entry · collisionDetection.ts Collision detection
Components 21
Game runtime
- Sketch entry
sketch.ts - Game controller
sketch/gameController.ts
Level world
- Level factory
sketch/levelFactory.ts - Active level
sketch/level.ts - Collision detection
sketch/collisionDetection.ts
Player and objects
- Player movement
sketch/player.ts - Platform blocks
sketch/block.ts - Fragile blocks
sketch/fragileBlock.ts - Bonus items
sketch/item.ts - Speed boost
sketch/speedBoost.ts - Game objects
sketch/_gameObject.ts - Position model
sketch/position.ts
Game screens and score
- Start screen
sketch/startScreen.ts - How to play
sketch/HowToPlayScreen.ts - Game over
sketch/gameOverScreen.ts - Score display
sketch/scoreboard.ts - Points animation
sketch/pointsAnimation.ts
Other components
- Player
- p5 runtime
- Browser storage
- Game assets
assets
Connections 32
- Player → Sketch entry: plays
- Sketch entry → Game controller: updates and draws
- Sketch entry → p5 runtime: uses canvas
- Sketch entry → Game assets: loads
- Game controller → Level factory: creates levels
- Game controller → Active level: updates and draws
- Game controller → Player movement: moves and bounces
- Game controller → Collision detection: checks contacts
- Game controller → Start screen: shows
- Game controller → How to play: shows
- Game controller → Game over: shows
- Game controller → Score display: draws
- Game controller → Browser storage: reads and writes scores
- Level factory → Active level: constructs
- Level factory → Platform blocks: creates
- Level factory → Fragile blocks: creates
- Level factory → Bonus items: creates
- Level factory → Speed boost: creates
- Platform blocks → Game objects: extends
- Fragile blocks → Game objects: extends
- Bonus items → Game objects: extends
- Speed boost → Bonus items: extends
- Player movement → Position model: tracks position
- Collision detection → Player movement: tests player
- Collision detection → Platform blocks: tests platforms
- Collision detection → Bonus items: tests pickups
- Game controller → Speed boost: applies effect
- Game controller → Points animation: updates via level
- Active level → Points animation: moves and draws
- Game over → Browser storage: reads scores
- Start screen → Browser storage: reads and saves name
- Game over → Game controller: restarts game