Skip to content

Refactor Frogger into ES6 modules and add professional README - #4

Draft
LuSilvaDeveloper with Copilot wants to merge 2 commits into
mainfrom
copilot/separate-code-into-modules
Draft

Refactor Frogger into ES6 modules and add professional README#4
LuSilvaDeveloper with Copilot wants to merge 2 commits into
mainfrom
copilot/separate-code-into-modules

Conversation

CopilotAI commented Mar 11, 2026

Copy link
Copy Markdown

All game logic lived in a single ~490-line index.js. This PR splits it into focused ES6 modules and updates the README to reflect the new structure.

Module breakdown (sources/modules/)

  • Sprite.jsSprite class (atlas coords, size, position)
  • Lane.jsLane constructor (direction, speed, sprites, river flag)
  • entities.js — all sprite/lane instances and the lanes array
  • state.js — shared mutable state: frog, player, canvas contexts, images
  • collision.jsisPointCollision / isBoxCollision helpers
  • renderer.js — all canvas draw functions (showStartScreen, renderBackground, renderFrog, etc.)
  • game.js — game loop, input handling, win/lose/timer logic

sources/index.js is now 8 lines — just event listener wiring and boot:

import{interfaceCanvas}from'./modules/state.js';import{showStartScreen}from'./modules/renderer.js';import{startGame,moveFrog}from'./modules/game.js';interfaceCanvas.addEventListener("click",startGame);document.addEventListener("keydown",moveFrog);window.addEventListener("load",showStartScreen);

HTML change

<script> updated to type="module" (implicitly deferred); onload="showStartScreen()" removed from <body> — startup is now owned by the entry module via window.load.

README

  • Added How to Run section (ES6 modules require HTTP — Live Server, python3 -m http.server, or npx serve)
  • Added module responsibility table
  • Updated tech stack to reflect ES6 Modules

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel

vercelBot commented Mar 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
froggerReadyReadyPreview, CommentMar 11, 2026 5:50am
frogger-neo-djsteErrorErrorMar 11, 2026 5:50am

Co-authored-by: LuSilvaDeveloper <107877216+LuSilvaDeveloper@users.noreply.github.com>
CopilotAI changed the title [WIP] Refactor code into modules for cleaner structureRefactor Frogger into ES6 modules and add professional READMEMar 11, 2026
Sign up for freeto 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

@LuSilvaDeveloper