CxD Archive
Video Game Project
Video Game Project
  • Project Introduction
  • Project Challenge
  • Project Outline
    • 1-1 Determine Gamer Motivation Profile
    • 1-2 Analyze External Motivations in Games
    • 1-3 Analyze Internal Motivations in Games
    • 1-4 Analyze Game Design Elements
    • 1-5 Phaser Practice 1: Matching Game
      • P1: Steps 1-5
      • P1: Steps 6-10
    • 1-6 Phaser Practice 2: Top-Down Game
      • P2: Steps 1-5
      • P2: Steps 6-10
      • P2: Steps 11-15
    • 1-7 Phaser Practice 3: Side-Scrolling Game
      • P3: Steps 1-5
      • P3: Steps 6-10
      • P3: Steps 11-15
    • 2-1 Form Project Teams
    • 2-2 Create Persona for Target Players
    • 2-3 Generate Game Ideas
    • 2-4 Refine Ideas to Create Game Treatments
    • 2-5 Evaluate Game Treatments
    • 3-1 Draft Game Design Document
    • 3-2 Create Paper Prototype of Game
    • 3-3 Playtest Paper Prototype
    • 3-4 Present Game Proposal
    • 4-1 Create Development Plan
    • 4-2 Code Game in Iterative Stages
    • 4-3 Create Art and Sound for Game
    • 4-4 Create Marketing Website
    • 5-1 Evaluate Game With Playtesters
    • 5-2 Evaluate Marketing Website
    • 5-3 Analyze Evaluation Data to Improve Solution
    • 6-1 Create Project Poster
    • 6-2 Present Project to Public
    • 6-3 Write Personal Reflection
  • Project References
    • Phaser Introduction
    • Phaser Game Template
    • Visual Assets
    • Audio Assets
    • Phaser Coding
      • Game Display
      • Game World
      • Game Camera
      • Text
      • Images
      • Sprites, Animations, and Health
      • Group of Sprites
      • Tilesprite Scrolling
      • Audio
      • Input
      • Physics and Collisions
      • Weapon
      • Particles
      • Tweens
      • Timers
      • Random Numbers
      • Enemy Behavior
      • Misc Game Features
  • Notes for Teachers
Powered by GitBook
On this page
  • What is Phaser?
  • How does Phaser work?
  • Where can I download Phaser?
  • Where can I learn how to use Phaser?
  • Why use Phaser instead of another game engine?
Export as PDF
  1. Project References

Phaser Introduction

PreviousProject ReferencesNextPhaser Game Template

Last updated 5 years ago

What is Phaser?

is a JavaScript library that makes it easier to code a game — similar to how is a JavaScript library that makes it easier to modify HTML and CSS on a webpage.

Phaser makes it easy to add your game's graphics to build a game world, add animations, add player inputs, add physics to your game world (velocity, gravity, friction, etc.), detect collisions between game objects, add particle explosions, play sounds, and so much more.

Phaser creates 2D games. However, if you're new to creating games, it's better to start with 2D.

How does Phaser work?

All you need to do is load the Phaser JS file into your webpage using a <script> tag, and then start using Phaser commands in your game code JS file.

The Phaser JS file contains code defining different types of JavaScript objects. An object is a special type of variable that can contain a set of properties (variables) and methods (functions).

In fact, a property (a variable) within an object can be another object — in other words, an object can contain other objects inside it.

Phaser objects have been specifically designed to have properties and methods that are useful for coding video games.

Every Phaser command is a reference to a Phaser object property or a Phaser object method. If the command has parentheses, then it is a reference to a method. Otherwise, it is a reference to a property.

Phaser creates your game by inserting an HTML <canvas> element into your webpage. The <canvas> element is a container that allows you to add graphics and text inside it using JavaScript. Things added inside the <canvas> element can be animated and interactive, which makes it perfect to use for a video game.

Where can I download Phaser?

You will need a copy of Phaser CE (phaser.min.js) inside your game folder, which will also contain your HTML, CSS, and JS files.

PHASER 3 VS. PHASER CE: Phaser 3 is the newest version of Phaser (first released in February 2018), which is maintained and updated by the folks at Photon Storm. Phaser CE is an open-source version of the previous Phaser 2, which is maintained and updated by the Phaser developer community.

While the API methods for Phaser 3 are similar to Phaser CE, code written for one will not work in the other without modification. All of the code examples in this project guidebook are based on Phaser CE. Eventually, this guidebook will be revised to use Phaser 3, which does offer improvements. However, in the meantime, be sure to use Phaser CE for this project.

Where can I learn how to use Phaser?

Besides the Phaser coding references available in this GitBook, here are additional online resources for learning more about using Phaser CE:

PHASER CE / PHASER 2: You can also find other Phaser resources online. Just keep in mind that Phaser 3 was released in February 2018, so newer resources might use Phaser 3 (which is not compatible with Phaser CE). Phaser resources published prior to 2018 will use Phaser 2 (which is now referred to as Phaser CE).

Why use Phaser instead of another game engine?

Some advantages of using Phaser:

  • It has lots of features for developing full-fledged games

  • It uses JavaScript (many cross-platform game engines use C++)

  • It's free and open-source

  • It's updated frequently to fix bugs and add new features

  • Its capabilities can be extended with plugins and integrations with other software

  • It has a large community of users (thus lots of online help available)

  • It's easy enough for beginners but powerful enough for seasoned developers

  • It's perfect for learning how to prototype and develop games — and can serve as a springboard for those who are more serious about game design and game development

Some limitations of using Phaser:

Overall, Phaser offers many advantages for learners new to creating video games, which is why it is utilized in this project.

However, this project could be modified to use other available game engines. The game design process will be similar, regardless of the specific game engine used for development.

RESOURCE:

RESOURCE:

. Click the "min.js" icon to download the file.

If you cannot download from Phaser.io, you can (version 2.13.1 — released May 15, 2019) from Google Drive. Click the download icon to save the file to your computer (and then add a copy of the file to your game folder in your code editor).

(Phaser 2 = Phaser CE)

(older examples prior to 2018 use Phaser 2, but newer examples use Phaser 3)

(her older examples prior to 2018 use Phaser CE, but newer examples use Phaser 3)

There are available for creating browser-based games. There are also numerous (such as: Unity, etc.) for making games for other platforms (consoles, PC, iOS, Android, etc.). So why use Phaser?

There are thousands of (see what's possible and get inspired)

It is limited to creating browser-based games (though you can )

It is limited to creating 2D games (though you can )

It is limited to single player games "out of the box" (though you can if you're more adventurous)

W3Schools has a great explanation of JavaScript Objects
If you're interested in learning more, W3Schools has an HTML Canvas tutorial
Get the latest version of Phaser CE from Phaser.io
download this archived version of Phaser CE
Phaser CE API Documentation on GitHub
Phaser CE Code Examples on Phaser.io
Phaser CE Code Examples on CodePen
Phaser community tutorials on Phaser.io
Phaser Game Examples by Emanuele Feronato
other JS game engines
game engines
games made with Phaser
convert your web app game into a native mobile app
create pseudo-3D isometric games
create multiplayer games with Phaser
Phaser
jQuery