Skip to content

Ping pong #50

@taniaveronicaM-afk

Description

@taniaveronicaM-afk
<title>LCD MEGA GAME FIXED</title> <style> body { background: black; color: white; font-family: monospace; text-align: center; } #screen { margin-top: 40px; font-size: 30px; } button { font-size: 24px; margin: 15px; padding: 10px 20px; } </style>

LCD MEGA GAME

LEFT
ACTION
RIGHT

<script> let position = 1; let score = 0; let lives = 3; function draw() { let row = ["◯","◯","◯"]; row[position] = "⬤"; document.getElementById("screen").innerHTML = "Score: " + score + " | Lives: " + lives + "

" + row[0] + " " + row[1] + " " + row[2]; } function left() { if(position > 0) position--; draw(); } function right() { if(position < 2) position++; draw(); } function action() { let target = Math.floor(Math.random()*3); if(target === position) { score++; } else { lives--; if(lives <= 0) { score = 0; lives = 3; } } draw(); } document.getElementById("leftBtn").addEventListener("touchstart", left); document.getElementById("rightBtn").addEventListener("touchstart", right); document.getElementById("actionBtn").addEventListener("touchstart", action); document.getElementById("leftBtn").addEventListener("click", left); document.getElementById("rightBtn").addEventListener("click", right); document.getElementById("actionBtn").addEventListener("click", action); draw(); </script> # @taniaveronicaM-afk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions