Skip to content

joshross4/HoopsDynasty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hoops Dynasty

An NES-style basketball game with side-scrolling gameplay, built with JavaScript and HTML5 Canvas.

Features

  • 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

How to Play

Option 1: Open directly in browser

  1. Open index.html in a web browser
  2. Press the spacebar to start the game

Option 2: Using npm (recommended)

  1. Install dependencies: npm install
  2. Start the server: npm start
  3. Open http://localhost:8080 in your browser

Gameplay

  1. Use arrow keys (or WASD) to move your player (red team)
  2. Press Up/W to jump
  3. Press spacebar to shoot when you have the ball
  4. Press Down/S to steal when near an opponent with ball (look for the red indicator)
  5. Try to score more points than the blue team before time runs out!

Controls

  • 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)

Gameplay

  • 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

Testing

The game includes a comprehensive testing suite to ensure all game mechanics work properly.

Running Tests

You can run the tests in several ways:

  1. Using npm to run all tests:

    npm test
    

    This will start a server and open the game in test mode automatically.

  2. 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
    
  3. 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
  4. 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

Test Coverage

The test suite checks:

  • Player movement
  • Ball physics
  • Shooting mechanics
  • Stealing mechanics
  • Scoring detection
  • AI behavior

Recent Changes

  • 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

About

A small game made with $15 of Claude credits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published