Starship Defender
Minimum price
Suggested price

Starship Defender

An HTML5 Game Tutorial using the Phaser Framework

About the Book

Learning to program and design games, is fun, challenging and very rewarding! This is the first in a series of books written to teach you different coding and design principles using a variety of game genres. Each game will present unique programming opportunities and insights to help you build your knowledge and confidence.

Starship Defender lets you explore a style of game and the unique development and coding challenges it presents.  This book is the result of teaching young people over several workshops the joy and challenge of creating HTML5 Javascript based games. It is an intriguing, informative and empowering adventure.  Learning to program with a goal in mind and being able to explore the code as you go, has always proven effect and motivating to my students. If this book does nothing else but remove the frustration  of "where do I start" and inspire you to the possibilities of programming and learning, it will have accomplished it's purpose.

To you who are about to start on this amazing path: have fun; support and inspire others; and enjoy the journey!

About the Author

James Allan

A multi-award-winning veteran of the motion picture and interactive digital media industries, James began his career as a visual effects designer, concept illustrator and storyboard artist. Career highlights include senior creative management roles at Digital Renaissance/Extend Media, Ganz, Phantom Compass, Director of Game Development at YTV, and Instructional Content Designer for TVOntario's Independent Learning Centre. Currently with Crowtrees Studio, James leads the production of 2D and 3D development for entertainment and educational games.

Table of Contents

  • Setting Up
    • Software and Files
    • Phaser
    • Brackets
    • GIMP
    • Project Files
    • Getting Started with Brackets
    • Loading The Game Project
    • A Tour of the Game Folder
    • The Code so far
    • What You Have Learned
  • Adding Sprites
    • Loading An Image
    • Creating a Game Sprite
    • Moving Sprites and the Game Loop
    • Sprite Origins or Anchor Points
    • Commenting and Commenting Out Code
    • The Code so far
    • What You Have Learned
  • Adding Arcade Physics
    • Turning Physics ON
    • Player Physics
    • Velocity
    • Collision Detection
    • The Code So Far
    • What You Have Learned
  • Adding Player Controls
    • Capture Keyboard Cursor Event
    • Creating Our First Method! : checkForInput
    • What You Have So Far
    • Checking for Keyboard Input
    • Checking the Left & Right Arrow Keys
    • Moving the Player
    • Creating a CONSTANT
    • Using Physics to Move the Player
    • Stopping the Player Moving
    • Improving Code Performance
    • Complete Player Controls
    • The Code So Far
    • What You Have Learned
  • Adding Animation
    • Introducing the Tile Sprite
    • Animated Game Sprites
    • The Code So Far
    • What You Have Learned
  • Adding Bullets
    • The Player Shoots
    • Bullets: Introducing Groups
    • The Create Method So Far
    • Bullet Time
    • Rate of Fire
    • Final Adjustments
    • The Code So Far
    • What You Have Learned
  • Adding Enemies
    • The Enemy Group
    • Collision Detection
    • Special Effects: Explosions
    • Enemy Horde!
    • Final spawnEnemy Method
    • The Code So Far
    • What You Have Learned
  • Adding Sound
    • About Sound File Formats
    • Loading Sounds
    • Creating Sound Sprites
    • Theme Music
    • The Code So Far
    • What You Have Learned
  • Adding the Interface
    • Player & Enemy Collision
    • Player Lives
    • The Score
    • The End Game
    • Game Over!
    • Restarting the Game
    • The Code So Far
    • What You Have Learned
  • Appendices
    • Additional Keyboard Input

Authors have earned$10,266,166writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub