How to Make a Simple HTML5 Canvas game via @zavolokas_eng
So here it is! Let’s jump right in by walking through game.js. You can also play the game right here.
1. Create the canvas
// Create the canvas var canvas = document.createElement("canvas"); var ctx = canvas.getContext("2d"); canvas.width = 512; canvas.height = 480; document.body.appendChild(canvas);The first thing we need to do is create a canvas element. I did this in JavaScript instead of HTML to demonstrate how easily it is accomplished. Once we have the element we get a reference to its context, set its dimensions and append it to the document’s body.
From the creator of HTML5 game Onslaught! Arena comes this fun step-by-step tutorial where you build an HTML5 game from scratch. Have fun!
Don’t forget Packt’s HTML5 Games Beginner’s Guide too: http://goo.gl/tRMg1
-
psiotka liked this
-
czumikakoooo liked this
-
cotorotom liked this
-
packtdavidb posted this
