Games on your phone · HTML + JavaScript

Bug Dodge — a game made on my phoneFREE

Watch the video

Drag to dodge the falling bugs. A complete game in one file: touch controls, speed-up, score and retry. Change the colours and speed to make it yours.

<style>
body { margin: 0; background: #0b0f17; }
canvas { display: block; }
</style>
<canvas id="c"></canvas>
<script>
const c = document.getElementById("c");
const ctx = c.getContext("2d");
let W = innerWidth, H = innerHeight;
c.width = W; c.height = H;
let px = W / 2;
let py = H - 160;
let bugs = [];
let speed = 3;
let over = false;
+ 59 more lines in the app
Open code G1 in Pocket Compiler Download the Pocket Compiler app — free

No app yet? Install it, then open the app and type the code G1 in Code Library.