HTML5 Game Programming with enchant.js.pdf
(
6195 KB
)
Pobierz
THE
EXPERT’S
VOICE®
IN WEB
DEVELOPMENT
HTML5
V
Game
Programming
with
enchant.js
GAMES
MADE
EASY
Brandon
Mclnnis,
Ryo
Shimizu,
Hidekazu
Furukawa,
Ryohei
Fushimi,
Ryo
Tanaka,
and
Kevin Kratzer
Apress®
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
Contents at a Glance
About the Authors�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xv
About the Technical Reviewer �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xvii
Acknowledgments �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xix
Introduction �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xxi
■
Chapter 1: Beginning enchant�½js Development�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½1
■
Chapter 2: JavaScript Basics �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½31
■
Chapter 3: Basic Features of enchant�½js �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½53
■
Chapter 4: Advanced Features of enchant�½js �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½79
■
Chapter 5: Game Design �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½103
■
Chapter 6: Creating an Arcade Shooter �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½127
■
Chapter 7: Creating a Stand-Alone 3-D Game �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½151
■
Appendix A: Class Appendix �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½173
Index �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½191
v
Introduction
If you’re reading this, you undoubtedly have some level of interest in making games for the web. As someone with
some experience in this field, I feel qualified to tell you you’re in the right place.
Games on the web have changed immensely in the last ten years and, while the core concepts of web games tend
to change very slowly over time, the tools we use to create them change much more rapidly. On today’s web, large
amounts of code must be written to accomplish simple, game-related tasks in a browser.
The open-source game engine enchant.js solves this problem by drastically reducing the amount of code needed
to write a game, and includes several fall-back and compatibility functions that work behind the scenes to keep things
running smoothly across multiple browsers without you needing to do anything special. It has become a very popular
tool in its home country in Japan, and is now being used more and more by programmers in the West.
If you’re a beginner to web coding, don’t worry! We walk you step-by-step through the basics of how enchant.js
works, JavaScript (the common scripting language of the web – used by enchant.js), and basic elements of an
enchant.js game. We then move on to more advanced topics. We cover all the necessities of a game, including scenes,
sprites, interactivity, and more. Additionally, we provide tutorials for every concept. In the second part of the book,
we show you how to create several games, including a Whack-A-Mole game (in 2-D and 3-D) and a classic arcade
space shooter.
Although some code samples in the book are linked to working versions on the free programming environment
code.9leap.net,
all code samples in this book can be found at the Apress website (www.apress.com) by searching for
this title and going to the source code section of this book’s page.
Learning game programming is a fun and exciting adventure with entertaining rewards. If you have a
question regarding the library, please don’t hesitate to reach out to us on the official enchant.js subreddit
(reddit.com/r/enchantjs),
enchantjs.com,
or our Facebook page (search for “enchant.js”). Our user community
is growing every day with both brand new and experienced game programmers.
Best of luck on your game programming journey!
Brandon McInnis
enchant.js Technical Evangelist
xxi
Chapter 1
Beginning enchant.js Development
The enchant.js framework was developed at the Ubiquitous Entertainment Inc. (UEI) Akihabara Research Center in
Tokyo and was originally released in April, 2011. It has enjoyed considerable popularity in Japan ever since and has a
growing base of fans from other countries. The enchant.js framework is an HTML5 and JavaScript-based game engine
and stand-alone code library that enables you to develop applications that can run on a PC or Mac or on iPhone, iPad,
and Android devices. Although game applications created using the engine can be run on many different kinds of
devices, most have been created and optimized for smartphone use.
The decline of Adobe Flash as an interactive platform in recent years has led modern web game developers
to turn to other browser-based and ubiquitous platforms, such as HTML5 and JavaScript, to create browser-based
experiences for their users. However, while JavaScript originally was developed to be a language accessible to
non-professional developers, the complexity of JavaScript used today for game authoring in the browser often
requires a large investment of time to learn and use efficiently. As an open-source game library, enchant.js reduces
this complexity by providing game authoring functionality for developers, which significantly minimizes your learning
curve for writing browser-based games and increases the speed of your game development.
With this book, you can start creating and publishing games quickly and easily. Don’t worry if you’re a complete
beginner to programming. We take you through all the basics so you can get up and running fast. If you are at an
intermediate level, we provide advanced content for you as well. We describe the different parts of the enchant.js
framework and create several games, including classic games like Whack-A-Mole and arcade shooters, along the way
to acquaint you with all the enchant.js library has to offer.
Visit the enchant.js Web Sites
To get a quick start with enchant.js, take a look at the three main enchant.js web sites. Each site has specific functions
that help you create and share games faster and easier.
•
•
•
http://enchantjs.com:
download the enchant.js code library, find resources, and read
programming tips
http://code.9leap.net:
develop, edit, and test games in an online, cloud-based environment
http://9leap.net:
upload, play, and share games
The main enchant.js site is where you can learn about the library and download the source code to develop your
own games. You can also develop games in an online environment on
code.9leap.net
for a streamlined experience.
After developing your game, you can post it to
9leap.net.
Figure
1-1
shows the basic relationship of the sites.
1
Plik z chomika:
daniellos525
Inne pliki z tego folderu:
All_In_One_Cracking_Guide_p.pdf
(3781 KB)
Build Windows 8 Apps with HTML5 and JavaScript.pdf
(18430 KB)
Hacking Basic Security - Penetration Testing and How to Hack.pdf
(392 KB)
Hacking Exposed Wireless Security Secrets And Solutions, 2nd Edition.pdf
(9645 KB)
HTML5 Game Development Insights.pdf
(14626 KB)
Inne foldery tego chomika:
czasopisma
Czasopisma1
Dla dzieci
kursy i PDFy
Metro 2033
Zgłoś jeśli
naruszono regulamin