HTML5游戲代碼10行
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>My Game</title> </head> <body> <canvas id="canvas" width="500" height="500"></canvas> <script> var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); ctx.fillRect(50, 50, 50, 50); </script> </body> </html>
以上是一段簡單的HTML5游戲代碼,只有10行,但可以繪制一個矩形