Let’s make HTML5 & JavaScript Games!
credit: w3.org
Lets make HTML5 & JavaScript Games! credit: w3.or g HTML is a - - PowerPoint PPT Presentation
Lets make HTML5 & JavaScript Games! credit: w3.or g HTML is a markup lan g ua g e Markup lan g ua g es are code-based annotation systems HTML is the backbone of every website HTML is made of elements openin g ta g closin g ta g
credit: w3.org
HTML is very easy to use! <section id=“box”>HTML is very easy to use!</section>
attribute closing tag element
credit: The Matrix
Name your folder CLF-html5-game
Save it as index.html in your folder
5 minutes after you write code without comments When you come back to it in 3 weeks
credit: thesilverpen.com
credit: Nintendo
A canvas is a rectangle in your page where you can use JavaScript to draw anything you want.
credit: Photon Storm
credit: Jandi Small
course of your app (e.g. your player’s health, location)
var myBestFriend = “Rebecca”; var myBestFriend = “Aileen”;
change the output
var fetch = function (dog) { run to the ball; pick up the ball; bring the ball back; };
attribute on the HTML document
var addition = 13 + 22; var division = 100/15;
Frame 1 Frame 6
per set amount of time
setInterval(function() { do stuff; }, 1000);
setInterval(function() { do stuff; }, 1000/60);
JAVASCRIPT RUNS UPDATE DRAW 60 times per second
X=0 x=WIDTH y=0 y=HEIGHT
X=0 x=WIDTH y=0 y=HEIGHT
(3,2)
addEventListener(“britishAreComing”, function (numberOfSoldiers) { paulRevere.ride(horse); town.alert(numberOfSoldiers); });
If is pressed down KeysDown (keyCode #38) If is no longer being pressed (keyCode #38) Delete “keydown” “keyup”
New position = old position + speed
radius
radius
Have these circles collided yet?
radius
radius
How about now?