An NES-style basketball game with side-scrolling gameplay, built with JavaScript and HTML5 Canvas.
- Retro pixel art style reminiscent of 8-bit era games
- FM synthesis sound effects
- Keyboard controls (arrow keys, spacebar, control/Z)
- Full basketball gameplay:
- Dribbling
- Shooting
- Passing
- Jumping
- Stealing
- Dynamic AI movement
- Shot clock
- Game clock
- Scoring
- Open
index.html
in a web browser - Press the spacebar to start the game
- Install dependencies:
npm install
- Start the server:
npm start
- Open http://localhost:8080 in your browser
- Use arrow keys (or WASD) to move your player (red team)
- Press Up/W to jump
- Press spacebar to shoot when you have the ball
- Press Down/S to steal when near an opponent with ball (look for the red indicator)
- Try to score more points than the blue team before time runs out!
- Arrow Keys / WASD: Move your player
- Up Arrow / W: Jump
- Spacebar: Shoot/Pass when you have the ball
- Down Arrow / S: Steal when near an opponent with the ball (red indicator)
- You control the player on the red team (highlighted in yellow)
- Shoot the ball through the opponent's hoop to score points
- The shot clock resets after scoring or turnovers
- Pass to teammates to position yourself better for scoring
- Steal the ball from opponents when you see the red "S" indicator
- The game lasts for 3 minutes
The game includes a comprehensive testing suite to ensure all game mechanics work properly.
You can run the tests in several ways:
-
Using npm to run all tests:
npm test
This will start a server and open the game in test mode automatically.
-
Using npm to run specific test categories:
npm run test:movement # Test player movement npm run test:physics # Test ball physics npm run test:shooting # Test shooting mechanics npm run test:stealing # Test stealing mechanics npm run test:scoring # Test scoring system npm run test:ai # Test AI behavior npm run test:changes # Test recent changes
-
In the browser console:
- Open the game in your browser
- Open the developer console
- Type
TestHoopsDynasty()
to run all tests - Or type
TestHoopsDynastyCategory('testCategory')
to run a specific test category
-
Via test mode URL:
- Run all tests:
index.html?test
- Run specific category:
index.html?test&category=testRecentChanges
- Tests will run automatically
- Check the console for results
- Run all tests:
The test suite checks:
- Player movement
- Ball physics
- Shooting mechanics
- Stealing mechanics
- Scoring detection
- AI behavior
- Improved AI player movement for more dynamic gameplay
- Added random movement patterns to create more realistic basketball action
- Adjusted stealing mechanics to make the game more balanced
- Added comprehensive test suite