tubeshowcase●1,194,391 videos♡ My collection 0
← Learn to Code

Learn to Code02:22

Code Flappy Bird on your Phone

Derek Banas ↗

From the creator

45 lines of JavaScript. One HTML file. No libraries written on an iPhone. Code: https://github.com/derekbanas/3-minute-games/blob/main/flappybird.html What’s actually happening: • Gravity is two lines — velocity accumulates, position follows it • Tapping sets velocity negative, because up is negative on a canvas • Each pipe is two rectangles, spawned every 90 frames • Collision is four comparisons between two boxes Three things people get wrong: leaving out the viewport meta tag, which renders the game at a third of its size on mobile; treating the bird as a point instead of a box with width; and testing for an exact position to score instead of setting a flag. Five numbers change the whole game — gravity, flap strength, scroll speed, spawn rate, gap height. Change them and tell me what you got.

Published 2026-08-31 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code