• Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
    JavaScript
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code archive for the book HTML5 Games: Novice to Ninja

HTML5 Games: Novice to Ninja

HTML5 Games

Hello and thanks for checking out HTML5 Games: Novice to Ninja! These are the code examples for the book. If you are reading this then you are among the first people in the world getting your hands dirty. If you have issues running the examples, find any inconsistencies and errors, or you have suggestions then please either log an issue or email me at [email protected] (or ping me @mrspeaker), I will try to help.

Try the examples.

They will run in all recent browsers - check out all the examples and play some of the games!

Making your own games

To modify the code and make your own game you'll need to be able to run it. Each example also includes an npm package.json file for converting the code into a single file that can be run in any browser. For each example you need to run:

npm install

You only have to do this once per example. This installs all the dependencies and files needed to run and package your game. Use the command:

npm start

It will start a webserver (at the URL http://localhost:9966/ by default). You can test your changes at the URL.

Building for the outside world

Once you've finished your game and are happy with your changes, you can run:

npm run build

Which will convert the code into a single build.js file that can be run with the included index.html file. These two files (along with any of your game assets and images) can then be deployed to a public server for everyone to play. If you make a game, please let me know on Twitter (@mrspeaker)!

Getting help

Setting up a workable build system to run code can be the most frustrating aspect of JavaScript development. If you are having any trouble running or modifying the examples, either log an issue on the code repository, send me an email at [email protected], or ping me @mrspeaker on twitter - and we'll get it sorted.

Using JavaScript Native Modules

Recently, most browsers have began to support JavaScript Native Modules. this means the step of converting all the code into a single file is not necessary - you can just make changes to your code and see the results without even needing npm.

(For Firefox before version 60 it's enabled behind the about:config dom.moduleScripts.enabled flag).

This is really convenient and cool - however, if you want to run your games locally on your own computer they still need to be served by a webserver. This is because JavaScript modules will only work via http:// and not file:// - so you can't just double-click and run it. There is a webserver in the root directory (that is, in html5games1/) that you can install and run (via npm) with:

npm install
npm start

This will run a server on http://localhost:9966/. If you browse here there will be links to each example.

Examples to come

I'm organizing the code for each chapter. There's still a little tidying going on. Also, still remaining:

ch09/01-02,05-10

More Repositories

1

jsninja2

A repo for the code archive for JavaScript: Novice to Ninja, 2nd Edition
JavaScript
244
star
2

mean1

Code archive for the book Full Stack JavaScript Development with MEAN
JavaScript
191
star
3

jsninja1

Code archive for the book JavaScript: Novice to Ninja
JavaScript
176
star
4

angularjs1

Code archive for the book AngularJS: Novice to Ninja
JavaScript
147
star
5

phpmysql6

Code archive for the book PHP: Novice to Ninja, 6th Edition
PHP
144
star
6

csspro1

A repository for the book CSS Master
HTML
139
star
7

htmlcss2

CSS
122
star
8

mobile1

Sample project from Mobile Web App Design book.
JavaScript
110
star
9

go1

Code archive for the book Level Up Your Web Apps With Go
Go
109
star
10

PHPPRO1

PHP Master: Write Cutting-edge Code
PHP
91
star
11

responsive2

A repo for the code for the book Jump Start Responsive Web Design, 2nd Edition
HTML
69
star
12

PHPMYSQL5

PHP & MYSQL: Novice to Ninja, Ed 5, code archive
PHP
68
star
13

jshtml1

Jump Start HTML5
JavaScript
66
star
14

NODEJS1

Jump Start Node.js, code archive
JavaScript
57
star
15

WPANT1

The WordPress Anthology
PHP
52
star
16

phpenv1-example

Example project for Jump Start PHP Environment
CSS
47
star
17

jssketch1

Example files and cheatsheet for Jump Start Sketch
HTML
44
star
18

JSJAVASCRIPT1

JumpStart Javascript
HTML
41
star
19

webperf1

A repository for the code archive of the book Lean Websites
CSS
40
star
20

JQUERY2

jQuery Novice to Ninja: Edition 2
JavaScript
36
star
21

SINATRA1

Jump Start Sinatra, code archive
Ruby
35
star
22

ultimatenode1

Code repository for the book "Node.js: Novice to Ninja"
JavaScript
32
star
23

jsfoundation1

A code archive for the book Jump Start Foundation
HTML
31
star
24

HTML3

Example code for Build Your Own Website 3rd Edition (HTML3)
JavaScript
31
star
25

JSPHP1

JumpStart PHP
CSS
29
star
26

csspro2

Code archive for the book CSS Master 2nd edition
HTML
29
star
27

JSRAILS1

JumpStart Rails
Ruby
28
star
28

phpmysql7

Code archive for the book PHP & MySQL: Novice to Ninja, 7th edition
PHP
26
star
29

ASPNET4

Example code for ASP.NET 4
ASP
25
star
30

COFFEESCRIPT1

Jump Start CoffeeScript, code archive
CoffeeScript
25
star
31

jsbootstrap1

Downloadable code for the book Jump Start Bootstrap
22
star
32

sql1

Simply SQL
HTML
22
star
33

JSCSS1

JumpStart CSS
JavaScript
22
star
34

phpmysql4

Build Your Own Database Driven Web Site Using PHP & MySQL, 4th Edition
PHP
21
star
35

csspro3

Code archive for the book CSS Master, 3rd Edition
HTML
21
star
36

CSSANT4

The CSS3 Anthology: Edition 4
JavaScript
21
star
37

freelancer1

The Principles of Successful Freelancing
HTML
20
star
38

rails3v5

A code archive for the book Rails:Novice to Ninja, 3rd edition, which covers Rails 5
Ruby
20
star
39

RESPONSIVE1

Responsive Web Design code repository
JavaScript
19
star
40

jsadobexd1

A repository for the archive of support files for jump Start Adobe XD
19
star
41

The-HTML5-Herald

HTML
19
star
42

project1

The Principles of Project Management
18
star
43

htmlemail1

Create Stunning HTML Email That Just Works!
HTML
18
star
44

wordpress1

Code archive for Build Your Own Wicked WordPress Themes
CSS
17
star
45

jsant1

The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks
HTML
17
star
46

jshtml-basics1

16
star
47

AJAX1

Example code for Build Your Own AJAX Web Applications book
JavaScript
16
star
48

javascript1

Simply JavaScript code archive
JavaScript
15
star
49

cssant3

The CSS Anthology: 101 Essential Tips, Tricks & Hacks, 3rd Edition
HTML
14
star
50

jsdesign1

The Art & Science of JavaScript
JavaScript
14
star
51

ux1

Killer UX Design
13
star
52

artmov1

How To: Convert PSD to HTML/CSS
13
star
53

linux1

Run Your Own Web Server using Linux & Apache
Shell
13
star
54

jsvuejs2

Code archive for the book Jump Start Vue.js, 2nd edition
Vue
13
star
55

jquery1

jQuery: Novice to Ninja
HTML
13
star
56

checklists2

Deliver First-Class Websites: 101 Essential Checklists
12
star
57

CLOUD1

Example code for Host your Web Site in the Cloud: Amazon Web Services Made Easy
PHP
12
star
58

photoshop2

Photoshop CS6 Unlocked, Ed 2, file archive
11
star
59

jshtml

Code for Jump Start HTML5
JavaScript
11
star
60

cssdesign1

The Art & Science of CSS
HTML
11
star
61

jsvuejs1

Code archive for the book Jump Start Vue.js
Vue
11
star
62

xml1

No Nonsense XML Web Development with PHP
PHP
10
star
63

tailwind

CSS
10
star
64

csswrong1

HTML
10
star
65

phpant2

PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition
PHP
10
star
66

dhtml1

DHTML Utopia: Modern Web Design Using JavasScript & DOM
JavaScript
10
star
67

FORMS1

Example code for Fancy Forms book
JavaScript
10
star
68

css2

HTML Utopia: Designing without Tables Using CSS, 2nd Edition
HTML
8
star
69

dreamweaver1

Build Your Own Standards Compliant Website Using Dreamweaver 8
HTML
8
star
70

ASPNETANT1

Example code for The ASP.NET 2.0 Anthology
C#
6
star
71

jshtml-canvas-svg1

Jump Start HTML5: Canvas and SVG
JavaScript
6
star
72

rails2

Simply Rails 2
Ruby
5
star
73

reactportfolio1

Assets for the book Build Your Own Developer Portfolio in React
3
star
74

PHOTOSHOP2video

Photoshop CS6 Unlocked, Ed 2, additional Photoshop edited video file
3
star
75

HTMLCSS1

3
star
76

jshtml-apis1

Jump Start HTML5: API's
JavaScript
2
star
77

jshtml-offline1

Jump Start HTML5: Offline
JavaScript
2
star
78

htmlcsscrashcourse

Example files for the the course HTML & CSS For Beginners
HTML
2
star
79

typescript-series

a repo for the code for our tutorial series on TypeScript
TypeScript
2
star
80

jshtml-multimedia1

JumpStart HTML5 Multimedia code repository
CSS
1
star
81

aspnet3

code archive
1
star