> For the complete documentation index, see [llms.txt](https://docs.launchboard.app/cxd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.launchboard.app/cxd/video-game/project-outline/1-5-phaser-practice-1-matching-game.md).

# 1-5 Phaser Practice 1: Matching Game

It's time to introduce you to the technology that your team will be using later to develop it's own game. This will be your first practice coding a browser-based video game using the [Phaser JS game engine](http://phaser.io/).

For this practice, all the game assets (i.e., images and sounds) and nearly all the game code will be provided. Focus on becoming familiar with how the code works.

This first practice will create a simple game. You're going to code an emoji matching game, similar to a slot machine. This game is based entirely on chance — no player skill involved. However, it will introduce you to some of the basic concepts of using Phaser to create a game.

![](https://728828027-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDgX-RykK9XCDxfIhX_%2F-LDgX7Ifr9nc11ubI925%2F-LDgXHXbTmGKwfo4nCpR%2Femoji-match-logo.png?generation=1527608060910777\&alt=media)

![](https://728828027-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDgX-RykK9XCDxfIhX_%2F-LDgX7Ifr9nc11ubI925%2F-LDgXHXdqZowVTG0HMXd%2Femoji-match.png?generation=1527608060912277\&alt=media)

**PREVIEW VIDEO:** [Demo of Emoji Match](https://drive.google.com/open?id=0B8MTiM_lFG9TOEZ3XzNOU3N6anc)

## PREP STEPS

1. Check out the [Phaser Introduction](https://docs.launchboard.app/cxd/video-game/project-references/phaser-introduction.md) to better understand what Phaser does and to download a copy of the latest version of Phaser (**phaser.min.js**).
2. Follow the instructions to prepare your [Phaser Game Template](https://docs.launchboard.app/cxd/video-game/project-references/phaser-game-template.md).
3. Download this [assets.zip](https://drive.google.com/open?id=0B8MTiM_lFG9TTTFWZktKa0U4VEU) file, and then extract (decompress) the file contents, which will be a folder named **assets** that contains one image file and three sound files. (To extract the file on a Windows computer, right-click on the downloaded zip file, and select *Extract All*. On a Mac, double-click on the downloaded zip file.)
4. Place the **assets** folder into your game template folder.
5. Test your Phaser game template by previewing the HTML file online. If everything's ready to go, you should see a **solid black box** (i.e., a blank Phaser game canvas) on your webpage.

**PHASER NOT LOADING?** If you only see a black outline around a white box (or see nothing at all), then Phaser isn't loading correctly. Try these troubleshooting tips:

* Be sure you downloaded the correct Phaser JS file: **phaser.min.js**
* Be sure your Phaser JS file is named: **phaser.min.js** — if necessary, rename the file in your game folder to this exact name.
* Be sure you placed **phaser.min.js** into the same folder that has your HTML, CSS, and JS files. If Phaser is in a different folder (or inside a subfolder), it will not load (unless you modify the `<script>` tag in your HTML file to load Phaser from its correct folder location).
* Be sure your **index.html** file includes `<script>` tags to load **phaser.min.js** and **code.js** (in that order) from your game folder.
* Be sure your **code.js** file lists the command to create a Phaser.Game object and includes the `preload()`, `create()`, and `update()` functions (must be present even if empty at first)
* Be sure your HTML, CSS, and JS files are running on a web server (such as: Editey web editor in Google Drive, CodePen, Codeanywhere, etc.).
* Check your browser's JavaScript console to see if there are errors listed.

## CODING STEPS

This first practice game will be coded in 10 steps. Overall, it doesn't take that much code to create this game; however, every step will explain how the code works.

In Step 1, you'll make a couple of changes to your HTML file and CSS file to demonstrate that the rest of the webpage surrounding your game can be modified. That will be useful later when your team develops its own game — you'll be able to customize the webpage to match your game's theme.

The rest of the steps are for coding your game, which will be done in your **code.js** file using Phaser JavaScript commands (as well as regular JavaScript).

The steps are outlined below. The instructions for Steps 1-5 start on the next page.

### Step 1: Modify HTML and CSS

### Step 2: Look at Starter Phaser JS Code

### Step 3: Change Background Color of Game

### Step 4: Add Emoji Sprite Using Image

### Step 5: Add Player Input

### Step 6: Add Sound Effect

### Step 7: Add Text to Game

### Step 8: Add Other Emoji Sprites

### Step 9: Add Custom Function to Check for Matches

### Step 10: Add Improvements to Game


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.launchboard.app/cxd/video-game/project-outline/1-5-phaser-practice-1-matching-game.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
