A simple retro-style 2D tank game built using the Enchant.js library, featuring keyboard and touch controls. Navigate your tank, attack enemies, and clear the map!
- ↑ (Up Arrow): Move Tank Up
- ↓ (Down Arrow): Move Tank Down
- ← (Left Arrow): Move Tank Left
- → (Right Arrow): Move Tank Right
- Spacebar: Attack / Shoot
- A virtual D-pad will appear on the bottom-left for tank movement (Up, Down, Left, Right).
- A "Attack" button will appear on the bottom-right to fire.
- Note: If keyboard controls become unresponsive, click on the game area to re-focus.
- Classic 2D tank gameplay.
- Dynamic map scrolling centered on the player.
- Enemy tanks with basic AI that attack periodically.
- Collision detection for player and bullets with map obstacles and enemies.
- Game Over and Winner screens.
- Sound effects for cannon fire and explosions.
- Responsive layout that centers the game on the screen.
- Support for both keyboard and touch inputs.
This is a web-based game, so no complex installation is required.
-
Clone the repository:
git clone [https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git](https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git) cd YOUR_REPOSITORY_NAME(Replace
YOUR_USERNAMEandYOUR_REPOSITORY_NAMEwith your actual GitHub details.) -
Open
index.html: Simply open theindex.htmlfile in your web browser. You can do this by double-clicking it or by dragging it into your browser window.
index.html: The main HTML file that sets up the game canvas and loads scripts.style.css: Contains CSS rules for centering the game and styling the info text.script.js: The core JavaScript game logic, including tank movement, enemy AI, bullet mechanics, and UI controls.- External Enchant.js Libraries and Assets:
The game relies on the Enchant.js library and its plugins, as well as game assets (images, audio) hosted externally. These are linked directly in
index.html:https://hankuro.sakura.ne.jp/build/enchant.js(Enchant.js Core)https://hankuro.sakura.ne.jp/build/plugins/ui.enchant.js(Enchant.js UI plugin for virtual controls)https://hankuro.sakura.ne.jp/build/plugins/mixing.enchant.js(Enchant.js Mixing plugin)- Various image and audio files from
hankuro.sakura.ne.jp.
- HTML5
- CSS3
- JavaScript
- Enchant.js: A simple JavaScript game engine.
- Enchant.js UI Plugin: For on-screen touch controls.
- Enchant.js Mixing Plugin: (Though its specific use isn't immediately obvious from the provided
script.jssnippet, it's included per theindex.html).
(It's highly recommended to add screenshots of your game here!)
Example:
Player tank navigating the map.
Mobile view with virtual controls.
This game utilizes assets from hankuro.sakura.ne.jp. Specific asset URLs are included within the script.js and index.html files.
This project is open-source. You might want to add a license file (e.g., MIT, Apache 2.0) to your repository.