CxD Archive
Code: Video Game
Code: Video Game
  • Code Introduction
  • What is Phaser?
  • TUTORIALS
    • A. Hello Phaser
      • 1 Create New Files
      • 2 Add HTML for Game
      • 3 Add CSS for Game
      • 4 Add JS for Game
      • 5 Add Image to Game
      • 6 Add Input to Game
    • B. Matching Game
    • C. Top-Down Game
    • D. Side-Scrolling Game
  • REFERENCES
    • TEMP - Links to Old References
    • Phaser CE Game Template
    • Creating Game Assets
      • Images
      • Animated Sprites
      • Sound Effects
    • Phaser CE Code References
      • Game Stage (Canvas)
      • Game World
      • Game Camera
      • Images
      • Sprites
      • Sprite Animations
      • Sprite Health
      • Sprite Groups
      • Physics - Properties
      • Physics - Collisions
      • Physics - Other Methods
      • Weapon and Bullets
      • Enemy AI Behaviors
      • Audio
      • Text
      • Input - Keys
      • Input - Mouse/Pointer
      • Particle Effects
      • Tween Animations
      • Tilesprite Background
      • Timers
      • Random Numbers
      • Game Controls
  • LINKS
    • Project Guidebook
    • Phaser CE API Code Reference
    • Phaser CE Code Examples
    • W3Schools JavaScript Tutorial
    • Piskel Animated Sprite Editor
    • Leshy Sound FX Maker
Powered by GitBook
On this page
  • Tutorial Goals
  • What is a Hello World program?
Export as PDF
  1. TUTORIALS

A. Hello Phaser

PreviousWhat is Phaser?Next1 Create New Files

Last updated 5 years ago

In this first tutorial, you'll code a "Hello World" game that displays the Phaser logo and changes the game's background color when the spacebar is pressed.

This won't be a true game (because it will lack an objective, rules, challenge, etc.). However, it will introduce you to coding with the Phaser CE game framework.

Tutorial Goals

The goals of this tutorial are to help you:

  • Understand the basic code structure of a Phaser CE game

  • Code a "Hello World" game with a simple player interaction

What is a Hello World program?

When learning a new programming language, the first step that many people take is to create what is called a program. Traditionally, this program simply displays the text "Hello World" on the screen and only requires a few lines of code. The purpose is to demonstrate that you can create a simple yet functional program in the new coding language. It's a first step before creating more complex programs with the new language.

A Phaser game can display text, so you could create a traditional "Hello World" message on the game screen. However, since video games typically use lots of images, you'll instead display an image on the screen. In addition, since video games require player interaction, you'll add the ability to detect input from the keyboard.

"Hello World"