TAAFT Tutorial
Generate image
Tasks
Generate text
Free mode
Trending
Leaderboard
Characters
Mini tools
New
Featured
Lists
Agents
Requests
Jobs
Map
Newsletter
Starter pack
Free tools
Speech to text
Text translator
Remove background
Settings
Edit profile
My tools
Gallery
Dashboard
Inbox
Get featured
Contact TAAFT
For you
Popular
Job impact index
Most saved
Affiliate program
Submit AI tool
Notification preferences
Glossary
Home
Timeline
My profile
Create tool
Deals
Companies
Models
Robots
Papers
Fundraises
Repositories
Devices
Organizations
Events
Prompt Pack
Merchendise
APIs
Features
Tools
Countries
Collections
Videos
▼ Most saved
Regex generator
Free mode
100% free
Freemium
Free Trial
-
Here is a simple HTML game code that meets your requirements. You can copy and paste it into a file and open it in your web browser to play. ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>2D Player Game</title> <style> body { margin: 0; overflow: hidden; } canvas { background: #87CEEB; display: block; margin: 0 auto; } .cube { position: absolute; width: 50px; height: 50px; background-color: red; } </style> </head> <body> <canvas id="gameCanvas" width="800" height="400"></canvas> <div id="cube" class="cube"></div> <script> const canvas = document.getElementById('gameCanvas'); const ctx = canvas.getContext('2d'); let player = { x: 50, y: 300, width: 50, height: 50, speed: 5, dy: 0, jumpPower: 10, gravity: 0.5, isJumping: false }; const cube = document.getElementById('cube'); cube.style.left = '400px'; cube.style.top = '300px'; function update() { ctx.clearRect(0, 0, canvas.width, canvas.height); drawPlayer(); drawCube(); handleMovement(); if (player.isJumping) { player.dy += player.gravity; player.y += player.dy; if (player.y + player.height >= canvas.height) { player.y = canvas.height - player.height; player.isJumping = false; player.dy = 0; } } requestAnimationFrame(update); } function drawPlayer() { ctx.fillStyle = 'blue'; ctx.fillRect(player.x, player.y, player.width, player.height); } function drawCube() { const cubeX = parseInt(cube.style.left); const cubeY = parseInt(cube.style.top); ctx.fillStyle = 'red'; ctx.fillRect(cubeX, cubeY, 50, 50); } function handleMovement() { if (keys[87] && !player.isJumping) { // W key player.dy = -player.jumpPower; player.isJumping = true; } if (keys[68]) { // D key player.x += player.speed; } if (keys[65]) { // A key player.x -= player.speed; } const cubeX = parseInt(cube.style.left); const cubeY = parseInt(cube.style.top); if (player.x < cubeX + 50 && player.x + player.width > cubeX && player.y < cubeY + 50 && player.y + player.height > cubeY) { // Collision detected cube.style.left = `${cubeX + 1}px`; } // Boundary checks if (player.x < 0) player.x = 0; if (player.x + player.width > canvas.width) player.x = canvas.width - player.width; } const keys = {}; window.addEventListener('keydown', (e) => { keys[e.keyCode] = true; }); window.addEventListener('keyup', (e) => { keys[e.keyCode] = false; }); update(); </script> </body> </html> ``` ## Details: - **Movement**: The player moves left and right using the "A" and "D" keys, respectively. Jumping is done using the "W" key. - **Physics**: The player can jump and will fall back down due to gravity. - **Interactions**: There is a red cube that the player can bump into. Colliding with it will cause the cube to slightly move. Feel free to modify the code as you wish!
Other tools
-
OpenPKS NCFeb 18, 2026@Cut And sew Generatorone of the worst I've ever seen -
OpenReally great number pattern generator. We have taken your tool and made some advanced changes here - https://texttoolz.com/tools/number-pattern-generator -
Robotic AI engine that scans business activities for proven EU regulatory violations.Open -
One of two tools ive ever used that understands with minimum leading how to read and fill in a flat UV texture template for designing clothing in vr
- Sponsor
Tripo AI 3D Generator
-
Open -
Open - Didn't find the AI you were looking for?

