Kindlasti! Siin on sama prompt, aga täielikult inglise keeles.
Prompt for an AI to create an HTML game
Role and Goal
You are an expert web developer specializing in creating interactive and engaging games using only HTML, CSS, and JavaScript. Your task is to build a fully functional game within a single HTML file. The game must combine the simple and satisfying mechanics of a scratch-off lottery ticket with the strategic and replayable elements of a roguelike game. All necessary CSS and JavaScript must be embedded within the HTML file.
Project Description: "Rogue Scratch"
Create a game called "Rogue Scratch". The player is presented with a grid of "scratchable" tiles. Beneath each tile is a hidden icon representing either a treasure, an enemy, a trap, or a special event. The player's goal is to collect as much gold and as many power-ups as possible while surviving the dangers. Each playthrough is unique, thanks to procedurally generated grids and permanent choices.
Core Mechanics
Game Board:
Generate a 5x5 grid. Each cell is a "scratchable" tile.
Initially, all tiles are covered and display a question mark (?) or a similar neutral icon.
Use the Font Awesome CDN to display all in-game icons. Add this to the HTML <head> section:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" />
Player Stats:
The player has three primary stats that must be clearly displayed on the screen:
Health (HP): Starts at 10. If HP reaches 0, the game is over.
Attack (ATK): Starts at 1. Used to defeat enemies.
Gold: Starts at 0. This is the main score of the game.
Hidden Icons and Their Meanings:
Each time a new grid is generated, randomly distribute the following icons beneath the tiles:
🪙 Coin (<i class="fa-solid fa-coins"></i>): Adds a random amount to the player's gold (e.g., 5-15 gold).
👹 Monster (<i class="fa-solid fa-skull-crossbones"></i>): The player fights a monster. The combat is automatic: if the player's ATK is greater than or equal to the monster's HP (e.g., monster has 2 HP), the player wins and gets a gold reward. If the player's ATK is lower, the player loses HP (e.g., 2-4 HP).
❤️ Heart (<i class="fa-solid fa-heart"></i>): Restores the player's HP (e.g., +3 HP).
⚔️ Sword (<i class="fa-solid fa-khanda"></i>): Permanently increases the player's ATK (+1 ATK).
🛡️ Shield (<i class="fa-solid fa-shield-halved"></i>): Grants a temporary buff (e.g., the next source of damage is halved). This is a rare find.
💣 Trap (<i class="fa-solid fa-bomb"></i>): The player immediately loses HP (e.g., -2 HP) or gold.
💨 Empty Tile: Some tiles are empty, and nothing happens. This adds an element of suspense.
Gameplay Loop (Roguelike Elements):
The player can scratch a limited number of tiles per level (e.g., 7 scratches).
After the scratches are used up, or if the player chooses to, they can proceed to the "Next Level".
The "Next Level" button generates a new, randomly populated 5x5 grid.
The player's stats (HP, ATK, Gold) carry over to the next level.
With each new level, enemies become slightly tougher and rewards get better, increasing the risk and reward.
Visual Design and User Experience (UI/UX)
Layout:
Use a clean and modern design. All game content should be centered on the page.
Header: A large, stylish title: "Rogue Scratch".
Stats Panel: Below the header, clearly display the HP, ATK, and Gold values, accompanied by their respective icons (heart, sword, coin).
Game Board: A large 5x5 grid, which is the most dominant visual element.
Message Log: Below the grid, include an area to display messages like, "You found 10 gold!", "You encountered a monster and won!", or "You triggered a trap and lost 2 HP!".
Controls: Clearly distinct buttons for "Next Level" and "Restart Game". The "Next Level" button is hidden initially and appears after the first tile is scratched.
Scratch-Off Effect:
The tiles must be interactive. On mouse hover, there should be a slight visual feedback (e.g., a shadow or a highlight).
When a tile is clicked, the cover layer or icon should smoothly fade out, revealing the hidden icon underneath. Use the CSS transition property for this effect.
A scratched tile should remain revealed and become non-interactive.
Color Scheme and Fonts:
Use either a dark theme (dark gray background, lighter text and elements) or a light, clean theme. Good contrast is essential.
Use a clean, readable font from Google Fonts (e.g., Poppins or Montserrat), imported in the HTML <head>.
Technical Requirements
Single File: All code must reside in a single index.html file. JavaScript must be within <script> tags, and CSS must be within <style> tags.
Code Comments: Add comments to the code to explain the JavaScript logic (e.g., grid generation, handling player choices, updating stats).
Mobile-Friendly: The layout must be responsive to look good and be playable on mobile devices.
Now, generate the complete HTML file based on this prompt.