A fun, interactive game where the player uses the arrow keys to move an avatar and collect coins. Each time the avatar collects a coin, the score increases, and the coin moves to a new random position on the screen.
You can play the game live here: Coin Game - DOM Manipulation
-
Desktop:
- Use the arrow keys to move the avatar.
- Arrow Up: Move the avatar up.
- Arrow Down: Move the avatar down.
- Arrow Right: Move the avatar to the right.
- Arrow Left: Move the avatar to the left.
- Use the arrow keys to move the avatar.
-
Mobile:
- Swipe in the direction you want to move the avatar.
- The avatar will follow the swipe direction (up, down, left, right).
-
When the avatar touches the coin, the score increases by one point, and the coin moves to a new random location.
-
Try to collect as many coins as possible!
- Responsive avatar movement with keyboard arrow keys and touch events.
- Random coin positioning when the coin is collected.
- Keeps track of and displays the score.
index.html
: Contains the HTML structure for the game.app.css
: Styles the game elements.app.js
: Contains the logic for avatar movement, collision detection, and score updating.
-
Clone the repository:
git clone <repo>
-
Open the
index.html
file in your browser to start playing the game.
- HTML
- CSS
- JavaScript
- Add more coins or different collectibles.
- Implement sound effects when collecting coins.
- Create levels or challenges with increasing difficulty.
This project is open source and available under the MIT License.