あるWeb系セミナーイベントのおまけで作ったcanvasを使ったゲームです。 と言っても点数が出るわけでもなく、戦闘機を動かして、クリックしたら弾が出て敵のタコキャラを消していくって一連の流れを追って作っていきましょう。 まずcanvasですが、お決まりのパターンとして憶えておきます。 //HTML内 <canvas id="shootingCanvas" width="1200" height="800"></canvas> 1200pxの横幅、800pxの高さのcanvasタグを書きます。 これをJavaScriptで読みにいきます。 これで、このあとはJavaScriptで変数「ctx」にドットシンタックス(ドット「.」で命令をつないでいく文法、JavaScriptやActionScriptでは定番)で書いていくことになります。 で、四角を描く方法は以下の通りです。(ソースをコピペし