{"id":16500522,"url":"https://github.com/carsonsgit/pong","last_synced_at":"2025-05-04T05:32:11.233Z","repository":{"id":191242294,"uuid":"683852806","full_name":"carsonSgit/Pong","owner":"carsonSgit","description":"Pong game coded in Game Programming.","archived":false,"fork":false,"pushed_at":"2023-11-25T00:38:05.000Z","size":110,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T04:22:10.190Z","etag":null,"topics":["game-programming","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carsonSgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-27T22:41:30.000Z","updated_at":"2024-08-25T19:46:48.000Z","dependencies_parsed_at":"2023-11-24T00:23:16.628Z","dependency_job_id":"92b20c3b-5ec2-4ca3-a1bf-b410ab205b51","html_url":"https://github.com/carsonSgit/Pong","commit_stats":null,"previous_names":["carsonsgit/pong"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carsonSgit%2FPong","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carsonSgit%2FPong/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carsonSgit%2FPong/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carsonSgit%2FPong/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carsonSgit","download_url":"https://codeload.github.com/carsonSgit/Pong/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252293082,"owners_count":21724960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-programming","javascript"],"created_at":"2024-10-11T14:57:57.881Z","updated_at":"2025-05-04T05:32:10.943Z","avatar_url":"https://github.com/carsonSgit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pong Game\n## Contributors\n - Vikram Singh: My teacher who created the base of this game\n - Carson Spriggs-Audet: Accomplished the instructions given to me and added extra functionality.\n\n## Overview\n\nThis is a simple implementation of the classic Pong game using HTML, CSS, and JavaScript. The game features two paddles, a ball, and basic game mechanics such as scoring, serving, and victory conditions. \nThe code structure includes separate classes for the paddles and the ball, promoting modularity and maintainability.\n\n# Screenshots\n\n## Begin Screen\n\n![beginScreen](https://github.com/carsonSgit/Pong/assets/92652800/2e115039-bd02-4390-9988-5d7cdad2dc0d)\n\n## Serve Screen\n\n![serveScreen](https://github.com/carsonSgit/Pong/assets/92652800/5d55226b-27c2-4ef0-8f57-a458c8580b67)\n\n## In Play\n\n![inPlay](https://github.com/carsonSgit/Pong/assets/92652800/0eeafeb3-670e-436f-b2a4-62b5b74eda32)\n\n## Player Scored\n\n![hasScore](https://github.com/carsonSgit/Pong/assets/92652800/e3a73d14-4b76-4e16-a7cd-bd34dbc7b5ad)\n\n## Toggle for multiplayer\n\nIn main.js, line 28 toggle this depending on your preference.\n\n![mainSingleplayerToggle](https://github.com/carsonSgit/Pong/assets/92652800/f84cdf16-1ecf-478d-a58f-25389e9596cf)\n\n## How to Play\n\n- **Controls:**\n  - Player 1 (Left Paddle): W (Up), S (Down)\n  - Player 2 (Right Paddle): Arrow Up (Up), Arrow Down (Down)\n  - Start/Serve/Restart: Enter\n\n- **Objective:**\n  - Score points by making the ball pass the opponent's paddle.\n  - The first player to reach the victory score (default is 3) wins.\n\n## Code Structure\n\n### HTML\n\n- The HTML file (`index.html`) defines the basic structure of the webpage, including the canvas element where the game is rendered.\n\n### JavaScript\n\n#### Main Game Logic (`main.js`)\n\n- **Game Initialization:**\n  - Creates a canvas element and sets its properties.\n  - Initializes paddles, ball, and game variables.\n\n- **Event Listeners:**\n  - Listens for keydown and keyup events to track player input.\n\n- **Game Loop:**\n  - The `gameLoop` function serves as the main loop, calling the `update` and `render` functions.\n\n- **Update Function:**\n  - Handles game logic, including state transitions, paddle and ball movement, scoring, and victory conditions.\n\n- **Render Function:**\n  - Draws the current game state on the canvas, including scores, paddles, ball, and state-specific messages.\n\n- **Paddle Class (`Paddle.js`):**\n  - Represents a paddle in the game.\n  - Handles paddle movement, AI for single-player mode, and rendering.\n\n- **Ball Class (`Ball.js`):**\n  - Represents the game ball.\n  - Manages ball movement, collisions with paddles and walls, and rendering.\n\n#### Utilities (`utilities.js`)\n\n- Contains utility functions for generating random numbers used in the ball's initial velocity.\n\n## Additional Features\n\n- **Single Player Mode:**\n  - Can be toggled on/off by setting the `singleplayer` variable in `main.js` to `true` or `false`.\n\n- **Custom Font:**\n  - Utilizes a custom font ('PublicPixel') for a retro-style aesthetic.\n\n- **Sound Effects:**\n  - Plays sound effects for scoring, victory, wall hits, and paddle hits.\n\n## How to Run\n\n1. Download all files.\n2. Open the `index.html` file in a modern web browser.\n\n## Acknowledgments\n\n- **Author:** Carson Spriggs-Audet\n- **Teacher:** Vikram Singh\n\nThis Pong game was developed as a Game Programming assignment based on my teacher Vikram Singh's code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarsonsgit%2Fpong","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarsonsgit%2Fpong","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarsonsgit%2Fpong/lists"}