Limit search to available items
Book Cover
E-book
Author Egges, Arjan, author

Title Building JavaScript games : for phones, tablets, and desktop / Arjan Egges
Published Berkeley, CA : Apress, 2014
New York, NY : Distributed to the Book trade worldwide by Springer
©2014

Copies

Description 1 online resource (xxvii, 444 pages) : illustrations
Contents Machine generated contents note: pt. I Getting Started -- ch. 1 Programming -- Computers and Programs -- Processor and Memory -- Programs -- Early Days: Imperative Programming -- Procedural Programming: Imperative + Procedures -- Object-Oriented Programming: Procedural + Objects -- Web Applications -- Programming Games -- Developing Games -- Small Scale: Edit-Interpret-Run -- Large Scale: Design-Specify-Implement -- Building Your First Web Application -- HTML5 Canvas -- JavaScript in a Separate File -- What You Have Learned -- ch. 2 Game Programming Basics -- Building Blocks of a Game -- Game World -- Game Loop -- Building a Game Application in JavaScript -- Structure of a Program -- Types of Applications -- Functions -- Syntax Diagrams -- Calling a Function -- Update and Draw -- Program Layout -- Comments -- Instructions vs. Lines -- Whitespace and Indentation -- What You Have Learned -- ch. 3 Creating a Game World -- Basic Types and Variables -- Types -- Declaration and Assignment of Variables -- Global Variables and Strict Mode -- Instructions and Expressions -- Operators and More Complex Expressions -- Arithmetic Operators -- Priority of Operators -- Assigning a Function to a Variable -- Variables Composed of Multiple Values -- Moving Square Game -- Scope of Variables -- What You Have Learned -- ch. 4 Game Assets -- Locating Sprites -- Loading Sprites -- Drawing Sprites -- Moving Sprites -- Loading and Drawing Multiple Sprites -- Music and Sounds -- What You Have Learned -- pt. II Creating Colorful Games -- ch. 5 Knowing What the Player Is Doing -- Sprite Following the Mouse Pointer -- Retrieving the Mouse Position -- Changing the Origin of a Sprite -- Using the Mouse Position to Rotate the Cannon Barrel -- What You Have Learned -- ch. 6 Reacting to Player Input -- Objects in Games -- Loading Sprites -- Handling a Key-Down Event -- Conditional Execution -- Comparison Operators -- Logic Operators -- Boolean Type -- Aiming the Barrel at the Mouse Pointer -- Number of Different Alternatives -- Toggling the Cannon Barrel's Behavior -- What You Have Learned -- ch. 7 Basic Game Objects -- Using Separate JavaScript Files -- Loading Game Assets the Wrong Way -- Methods and Functions -- Loading Game Assets the Right Way -- Writing a More Efficient Game Loop -- Separating Generic Code from Game-Specific Code -- Adding a Ball to the Game World -- Creating the Ball -- Shooting the Ball -- Updating the Ball -- What You Have Learned -- ch. 8 Game Object Types -- Creating Multiple Objects of the Same Type -- Constructing Game Objects as Part of the Game World -- Writing a Class with Multiple Instances -- Dealing with Randomness in Games -- Calculating a Random Velocity and Color -- Updating the Paint Can -- Drawing the Cans on the Screen -- Representing Positions and Velocities as Vectors -- Default Values for Parameters -- What You Have Learned -- ch. 9 Colors and Collisions -- Different Way to Represent Colors -- Controlled Data Access for Objects -- Read-Only Properties -- Retrieving the Color of the Cannon -- Handling Collisions between the Ball and the Cans -- What You Have Learned -- ch. 10 Limited Lives -- Maintaining the Number of Lives -- Indicating the Number of Lives to the Player -- Executing Instructions Multiple Times -- Shorter Notation for Incrementing Counters -- More Compact Looping Syntax -- Few Special Cases -- No Repeat at All -- Infinite Repeat -- Nested Repeats -- Restarting the Game -- What You Have Learned -- ch. 11 Organizing Game Objects -- Similarities between Game Objects -- Inheritance -- Game Objects and Inheritance -- Cannon as a Subclass of ThreeColorGameObject -- Overriding Methods from the Superclass -- Ball Class -- Polymorphism -- Hierarchies of Classes -- Values vs. References -- Null and Undefined -- What You Have Learned -- ch. 12 Finishing the Painter Game -- Adding Motion Effects -- Adding Sounds and Music -- Maintaining a Score -- More Complete Canvas2D Class -- Characters and Strings -- Using Single and Double Quotes -- Special Characters -- String Operations -- Few Final Remarks -- What You Have Learned -- pt. III Jewel Jam -- ch. 13 Adapting to Different Devices -- Allowing the Canvas to Change Size -- Setting the Native Game Size -- Resizing the Game -- Redesigning Mouse-Input Handling -- Arrays -- Handling Keyboard Input Using Arrays -- Touchscreen Input -- Making Dealing with Touch Input Easier -- Adding Touch Input to Painter -- What You Have Learned -- ch. 14 Game Objects in a Structure -- Game Objects in a Grid -- Creating a Grid of Sprites -- Drawing the Grid -- Grid Operations -- More Possibilities with Grids -- Hierarchy of Game Objects -- Anatomy of a Game Object -- Relations between Game Objects -- Local vs. Global Positions -- Layers of Game Objects -- Different Kinds of Game Objects -- Sprite Game Object -- List of Game Objects -- Grid of Game Objects -- Grid of Jewels -- Moving Smoothly on the Grid -- Dragging Rows in the Grid -- Creating the Game Objects -- What You Have Learned -- ch. 15 Gameplay Programming -- Interaction between Game Objects -- Assigning Identifiers to Game Objects -- Finding Game Objects -- Recursion -- Accessing the Game World -- Jewel Class -- Maintaining the Current Score -- Moving Jewel Cart -- Dealing With Combinations of Jewels -- Finding Valid Combinations -- Removing Jewels from the Grid -- Updating Other Game Objects -- What You Have Learned -- ch. 16 Game States -- Adding a Title Screen -- Adding a Button to Show a Help Frame -- Overlays -- What You Have Learned -- ch. 17 Finishing the Jewel Jam Game -- Extra Points for Multiple Combinations -- Time in Games -- Controlling the Visibility of a Game Object -- Field of Glitters -- Constructor -- Adding Glitters -- Updating the Glitter Field -- Drawing the Glitter Field -- Adding Glitters to Game Objects -- Adding Music and Sound Effects -- What You Have Learned -- pt. IV Penguin Pairs -- ch. 18 Sprite Sheets -- Overview of the Example Program -- Loading a Sprite Sheet -- Managing the Sprite Sheet -- Finalizing the Example -- What You Have Learned -- ch. 19 Menus and Settings -- Setting Up the Menu -- Adding an On/off Button -- Adding a Slider Button -- Reading and Storing Game Settings -- What You Have Learned -- ch. 20 Game State Management -- Basics of Managing Game States -- Game-State Manager -- Adding States and Switching Between Them -- Level Menu State -- Dealing with Errors -- What You Have Learned -- ch. 21 Storing and Recalling Game Data -- Structure of a Level -- Tile Class -- Other Level Information -- Playing State -- Creating the Levels in the Playing State -- Creating the Level Instances -- Using switch to Handle Alternatives -- break Instruction -- Loading Different Kinds of Tiles -- Maintaining the Player's Progress -- What You Have Learned -- ch. 22 Pairing the Penguins -- Selecting Penguins -- Arrow Class -- Animal Selector -- Handling Input in Reverse Order -- Updating Animals -- Meeting Other Game Objects -- Maintaining the Number of Pairs -- What You Have Learned -- ch. 23 Finishing the Penguin Pairs Game -- Separating Code into Different Modules -- Variables as Namespaces -- Design Pattern for Namespaces -- Finishing the User Interface -- Showing Hints -- Resetting the Level -- Moving to the Next Level -- Adding Sound Effects -- Few Final Notes -- What You Have Learned -- pt. V Tick Tick -- ch. 24 Main Game Structure -- Overview of the Game Structure -- Structure of a Level -- Water Drops -- Tile Class -- Level Class -- What You Have Learned -- ch. 25 Animation -- What Is Animation? -- Animation Class -- Animated Game Object -- Playing an Animation -- Player Class -- What You Have Learned -- ch
26 Game Physics -- Locking the Character in the Game World -- Setting the Character at the Right Position -- Jumping -- ... And Falling -- Collision Detection -- Retrieving Bounding Boxes -- Per-Pixel Collision Detection -- Accessing Pixel Color Data in Images -- Calculating the Overlap Rectangle -- Checking the Pixels in the Overlap Rectangle -- Handling Character-Tile Collisions -- Dealing with the Collision -- What You Have Learned -- ch. 27 Intelligent Enemies -- Rocket -- Creating and Resetting the Rocket -- Programming the Rocket Behavior -- Patrolling Enemy -- Basic PatrollingEnemy Class -- Different Types of Enemies -- Other Types of Enemies -- Loading the Different Types of Enemies -- What You Have Learned -- ch. 28 Adding Player Interaction -- Collecting Water Drops -- Ice Blocks -- Enemies Colliding With the Player -- What You Have Learned -- ch. 29 Finishing the Tick Tick Game -- Adding a Timer -- Making the Timer Go Faster or Slower -- When the Timer Reaches Zero -- Drawing Mountains and Clouds -- Finalizing the Level Progression -- What You Have Learned -- pt. VI Into the Great Wide Open -- ch. 30 Producing Games -- Designing Games -- Developing Games -- Third-Party Libraries -- Efficiency of Code -- Coherency of Code -- Producing Game Content -- Working on a Game Production Team -- ch. 31 Publishing Games -- Testing and Checking Code Quality -- Deployment -- Selling Your Game -- Marketing -- Final Thoughts
Summary Building JavaScript Games teaches game programming through a series of engaging, arcade-style games that quickly expand your JavaScript and HTML5 skills. JavaScript is in the top ten most-used programming languages world wide, and is the basis for applications that can run in any modern browser, on any device from smart phone to tablet to PC. Especial emphasis is given to touch-based interface, but all games also run using a regular mouse and keyboard setup. The four games you?ll develop from reading this book are: Painter Jewel Jam Penguin Pairs Tick Tick These four games are casual, arcade-style games representing the aim-and-shoot, puzzle, maze, and platform styles of game play. The approach in Building JavaScript Games follows the basic structure of a game rather than the syntax of a language. From almost the very first chapter you are building games to run on your phone or other device and show to your friends. Successive projects teach about handling player input, manipulating game objects, designing game worlds, managing levels, and realism through physics. All told, you?ll develop four well-designed games, making Building JavaScript Games one of the most enjoyable ways there is to learn about programming browser-based games
Notes Includes index
English
Online resource; title from PDF title page (SpringerLink, viewed October 14, 2014)
Subject JavaScript (Computer program language)
Video games -- Programming.
Application software -- Development.
GAMES -- Board.
Application software -- Development
Video games -- Programming
JavaScript (Computer program language)
Form Electronic book
ISBN 9781430265399
1430265396