Land-or-Water
March 26, 2024 ยท View on GitHub
I came across this cool looking repository and had an idea to create my own version.
How it Works
- Open the
index.htmlfile in a web browser. - The game will start automatically, with two balls (green for land and blue for water) bouncing around the globe.
- The globe is divided into tiles, with one half initially representing land (shades of green and brown) and the other half representing water (shades of blue).
- When a ball collides with a tile of the opposite territory, the tile's color changes to the ball's color (either a land or water shade).
- The land and water scores at the bottom of the screen indicate the current area captured by each territory.
- The page background color will change dynamically based on which territory (land or water) is currently dominating.
- The game continues indefinitely until you decide to stop or refresh the page.
How to Customize
You can easily customize various aspects of the game by modifying the JavaScript code:
- Color Palette: Adjust the color shades for land and water tiles by modifying the
colorPaletteobject in the code. - Square Size: Change the size of the tiles by modifying the
SQUARE_SIZEconstant. - Ball Speed: Adjust the minimum and maximum ball speeds by modifying the
MIN_SPEEDandMAX_SPEEDconstants. - Ball Colors: Change the colors of the land and water balls by modifying the
LAND_BALL_COLORandWATER_BALL_COLORconstants.