How felipedenuzzo/gravidade-web works
Gravidade Web is a browser version of a tilt-controlled, phase-based collection game. The player selects a mode and difficulty, then steers the ball to collect phase items; timed modes can end in timeout, while clearing the orange targets leads to victory and phase progression. The runtime is organized around js/main.js, with separate physics, phase configuration, item, magnet, black-hole, HUD, overlay, and transition-video systems. The excerpts show key interactions, but not every runtime call site, so uncertain links are omitted.
Main entry points: main.js Game orchestrator · index.html Game page · ItemFactory.js Items and targets · Physics.js Ball physics
Components 15
Game flow
- Game orchestrator
js/main.js - Game state
js/GameState.js - Phase rules
js/PhaseManager.js
Simulation
- Items and targets
js/ItemFactory.js - Ball physics
js/Physics.js - Magnet obstacles
js/MagnetSystem.js - Black holes
js/BlackHole.js
Player interface
- Game page
index.html - Status HUD
js/HUD.js - Menus and outcomes
js/OverlayManager.js - Game presentation
style.css
Game media
- Transition videos
js/IntroSystem.js - Game assets
assets
Other components
- Player
- Browser sensors
Connections 18
- Player → Game page: opens
- Game page → Game orchestrator: loads
- Game orchestrator → Game state: updates
- Game orchestrator → Phase rules: gets phase rules
- Game orchestrator → Items and targets: initializes
- Game orchestrator → Items and targets: checks collection
- Game orchestrator → Ball physics: starts loop
- Browser sensors → Ball physics: orientation input
- Ball physics → Magnet obstacles: applies repulsion
- Game orchestrator → Magnet obstacles: creates obstacles
- Game orchestrator → Black holes: creates field
- Game orchestrator → Status HUD: updates display
- Game orchestrator → Menus and outcomes: shows menus and outcomes
- Game orchestrator → Transition videos: plays transitions
- Items and targets → Game assets: loads item images
- Magnet obstacles → Game assets: loads magnet images
- Black holes → Game assets: loads image
- Game page → Game presentation: uses styles