Skip to content

Conversation

hdjdjdudjdidjsjduejdjshhdhd-ops
<title>لعبة JavaScript بسيطة</title> <style> canvas { border: 1px solid black; } </style> <script> const canvas = document.getElementById("gameCanvas"); const ctx = canvas.getContext("2d");
                                            let player = { x: 400, y: 500, width: 50, height: 50, speed: 5 };

                                                            function drawPlayer() {
                                                                        ctx.fillStyle = "red";
                                                                                    ctx.fillRect(player.x, player.y, player.width, player.height);
                                                                                            }

                                                                                                            function gameLoop() {
                                                                                                                        ctx.clearRect(0, 0, canvas.width, canvas.height);
                                                                                                                                    drawPlayer();
                                                                                                                                                requestAnimationFrame(gameLoop);
                                                                                                                                                        }

                                                                                                                                                                        window.addEventListener("keydown", (e) => {
                                                                                                                                                                                    if (e.key === "ArrowLeft" && player.x > 0) player.x -= player.speed;
                                                                                                                                                                                                if (e.key === "ArrowRight" && player.x < canvas.width - player.width) player.x += player.speed;
                                                                                                                                                                                                        });

                                                                                                                                                                                                                        gameLoop();
                                                                                                                                                                                                                            </script>
                                                                                                                                                                                                                            </body>
                                                                                                                                  using UnityEngine;

                                                                                                                                  public class PlayerMovement : MonoBehaviour
                                                                                                                                  {
                                                                                                                                      public float moveSpeed = 5f;

                                                                                                                                              void Update()
                                                                                                                                                  {
                                                                                                                                                          float horizontal = Input.GetAxis("Horizontal");
                                                                                                                                                                  float vertical = Input.GetAxis("Vertical");

                                                                                                                                                                                  Vector3 movement = new Vector3(horizontal, 0f, vertical) * moveSpeed * Time.deltaTime;
                                                                                                                                                                                          transform.Translate(movement);
                                                                                                                                                                                              }
                                                                                                                                                                                              }import pygame
                                                                                                                                                                                              pygame.init()

                                                                                                                                                                                              # إنشاء نافذة اللعبة
                                                                                                                                                                                              screen = pygame.display.set_mode((800, 600))
                                                                                                                                                                                              pygame.display.set_caption("لعبة بسيطة")

                                                                                                                                                                                              # اللاعب (مربع صغير)
                                                                                                                                                                                              player = pygame.Rect(400, 500, 50, 50)
                                                                                                                                                                                              player_speed = 5

                                                                                                                                                                                              # اللعبة تعمل
                                                                                                                                                                                              running = True
                                                                                                                                                                                              while running:
                                                                                                                                                                                                  screen.fill((0, 0, 0))  # خلفية سوداء

                                                                                                                                                                                                          for event in pygame.event.get():
                                                                                                                                                                                                                  if event.type == pygame.QUIT:
                                                                                                                                                                                                                              running = False

                                                                                                                                                                                                                                      # تحريك اللاعب بالأزرار
                                                                                                                                                                                                                                          keys = pygame.key.get_pressed()
                                                                                                                                                                                                                                              if keys[pygame.K_LEFT] and player.x > 0:
                                                                                                                                                                                                                                                      player.x -= player_speed
                                                                                                                                                                                                                                                          if keys[pygame.K_RIGHT] and player.x < 750:
                                                                                                                                                                                                                                                                  player.x += player_speed

                                                                                                                                                                                                                                                                          pygame.draw.rect(screen, (255, 0, 0), player)  # رسم اللاعب
                                                                                                                                                                                                                                                                              pygame.display.update()

                                                                                                                                                                                                                                                                              pygame.quit()                                                                                          </html>

At the moment we are not accepting contributions to the repository.

<html>
<head>
    <title>لعبة JavaScript بسيطة</title>
        <style> canvas { border: 1px solid black; } </style>
        </head>
        <body>
            <canvas id="gameCanvas" width="800" height="600"></canvas>
                <script>
                        const canvas = document.getElementById("gameCanvas");
                                const ctx = canvas.getContext("2d");

                                                let player = { x: 400, y: 500, width: 50, height: 50, speed: 5 };

                                                                function drawPlayer() {
                                                                            ctx.fillStyle = "red";
                                                                                        ctx.fillRect(player.x, player.y, player.width, player.height);
                                                                                                }

                                                                                                                function gameLoop() {
                                                                                                                            ctx.clearRect(0, 0, canvas.width, canvas.height);
                                                                                                                                        drawPlayer();
                                                                                                                                                    requestAnimationFrame(gameLoop);
                                                                                                                                                            }

                                                                                                                                                                            window.addEventListener("keydown", (e) => {
                                                                                                                                                                                        if (e.key === "ArrowLeft" && player.x > 0) player.x -= player.speed;
                                                                                                                                                                                                    if (e.key === "ArrowRight" && player.x < canvas.width - player.width) player.x += player.speed;
                                                                                                                                                                                                            });

                                                                                                                                                                                                                            gameLoop();
                                                                                                                                                                                                                                </script>
                                                                                                                                                                                                                                </body>
                                                                                                                                      using UnityEngine;

                                                                                                                                      public class PlayerMovement : MonoBehaviour
                                                                                                                                      {
                                                                                                                                          public float moveSpeed = 5f;

                                                                                                                                                  void Update()
                                                                                                                                                      {
                                                                                                                                                              float horizontal = Input.GetAxis("Horizontal");
                                                                                                                                                                      float vertical = Input.GetAxis("Vertical");

                                                                                                                                                                                      Vector3 movement = new Vector3(horizontal, 0f, vertical) * moveSpeed * Time.deltaTime;
                                                                                                                                                                                              transform.Translate(movement);
                                                                                                                                                                                                  }
                                                                                                                                                                                                  }import pygame
                                                                                                                                                                                                  pygame.init()

                                                                                                                                                                                                  # إنشاء نافذة اللعبة
                                                                                                                                                                                                  screen = pygame.display.set_mode((800, 600))
                                                                                                                                                                                                  pygame.display.set_caption("لعبة بسيطة")

                                                                                                                                                                                                  # اللاعب (مربع صغير)
                                                                                                                                                                                                  player = pygame.Rect(400, 500, 50, 50)
                                                                                                                                                                                                  player_speed = 5

                                                                                                                                                                                                  # اللعبة تعمل
                                                                                                                                                                                                  running = True
                                                                                                                                                                                                  while running:
                                                                                                                                                                                                      screen.fill((0, 0, 0))  # خلفية سوداء

                                                                                                                                                                                                              for event in pygame.event.get():
                                                                                                                                                                                                                      if event.type == pygame.QUIT:
                                                                                                                                                                                                                                  running = False

                                                                                                                                                                                                                                          # تحريك اللاعب بالأزرار
                                                                                                                                                                                                                                              keys = pygame.key.get_pressed()
                                                                                                                                                                                                                                                  if keys[pygame.K_LEFT] and player.x > 0:
                                                                                                                                                                                                                                                          player.x -= player_speed
                                                                                                                                                                                                                                                              if keys[pygame.K_RIGHT] and player.x < 750:
                                                                                                                                                                                                                                                                      player.x += player_speed

                                                                                                                                                                                                                                                                              pygame.draw.rect(screen, (255, 0, 0), player)  # رسم اللاعب
                                                                                                                                                                                                                                                                                  pygame.display.update()

                                                                                                                                                                                                                                                                                  pygame.quit()                                                                                          </html>
Copy link

github-actions bot commented Aug 2, 2025

At the moment we are not accepting contributions to the repository.

Feedback for Copilot.vim can be given in the feedback forum.

@github-actions github-actions bot closed this Aug 2, 2025
@mahmoudahmed25
Copy link

mahmoudahmed25 commented Aug 27, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants