How rilomilo/flappybird works
Project type and purpose
• This is a single‐page, front-end game project written in TypeScript and bundled with Webpack.
• It implements a modified Flappy Bird clone using the HTML5 Canvas API.
• Features include a resource loader, game loop (Runtime), input controller, various game elements (bird, land, pipes), audio effects, and a menu UI.
File structure
• Top-level files:
– package.json / tsconfig.json / webpack.config.js: build and dependency configuration.
– index.html: game container and canvas element.
• res/: static assets
– res/img/: (any image assets you add)
– res/sound/: MP3 clips for effects (duang, fly, score)
• src/: application code
– src/index.ts: application entry point—bootstraps resource loader and launches the Runtime.
– src/declare.ts: global type declarations.
– src/game/: core game logic
· GameMenu.ts: menu and start/restart UI.
· Runtime.ts: central game loop, update & render calls.
· SpiritController.ts: input handling (mouse/tap) for controlling the bird.
– src/game/elements/: domain models and renderable objects
· Level.ts, Live.ts, Score.ts: game state trackers (level progression, remaining lives, scoring).
· src/game/elements/spirits/: sprites/entities (Bird, Land, Pencil (pipe), BackGround) all extend Spirit.ts.
– src/modules/: cross-cutting services
· Resource.ts: loads images and audio before game start.
· Sound.ts: plays audio clips on game events (flap, collision, score).
– src/style/style.less: styles for canvas container and menu.
README for additional insights
• Confirms it’s a “魔改版” (modified) Flappy Bird on Canvas.