phaser presentation

24
Patrick John Pacaña Front-End Developer *(by day) LIG Inc. * a lazy-ass game developer wannabe (by night)

Upload: patrick-pacana

Post on 16-Apr-2017

120 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Phaser presentation

Patrick John PacañaFront-End Developer *(by day)LIG Inc.

* a lazy-ass game developer wannabe (by night)

Page 2: Phaser presentation

Getting started with

Phaser

Page 3: Phaser presentation

What is Phaser?

Page 4: Phaser presentation

What is Phaser?

Desktop and Mobile HTML5 game framework

A fast, free and fun open source framework for Canvas and WebGL powered browser games.

Page 5: Phaser presentation

Why Phaser?

Page 6: Phaser presentation

Why Phaser?

it runs natively on your browser “look ma, no browser plugins!”

Page 7: Phaser presentation

Why Phaser?

code in JavaScript open source and actively developed extensive documentation a large community behind it and a truck load of examples

Page 8: Phaser presentation

Installation and Environment (for this presentation)

phaser.js libraryhttp://phaser.io/

any http web server Typescript (optional)

http://www.typescriptlang.org/ Tiled map editor

http://www.mapeditor.org/

Page 9: Phaser presentation

Let’s create a game!“because we are cool”

Page 10: Phaser presentation

A simple Bomberman Game

Create the tiles, the blocks and bricks Add bomberman, some enemies and bombs Make bomberman move using the keyboard Bomberman dies when it touches the

enemies or explosions Enemies die when when it touches the

explosions

Page 11: Phaser presentation

What we’ll need for our Bomberman game

Entry point to the game engine A way to add Tiles A way to add Game Objects Listen to Keyboard Input Detect Game Object collisions

Page 12: Phaser presentation

The Classes that we’ll need(for our Bomberman Game)

Entry point to the game enginePhaser.Game, Phaser.Loader

A way to add Tiles Phaser.Tilemap

A way to add Game ObjectsPhaser.Sprite, Phaser.AnimationManager

Listen to Keyboard InputPhaser.Input

Detect Game Object collisionsPhaser.Physics.Arcade, Phaser.Physics.Arcade.Body

Page 13: Phaser presentation

Phaser.Game

This is where the magic happens. The Game object is the heart of your game, providing quick access to common functions and handling the boot process.

Page 14: Phaser presentation

Phaser.Game default states

preloadis where asset preloading is set

createis where game initializations are set

updateis where the life of your game happens

renderis where debugging infos are set

Page 15: Phaser presentation

Phaser.Loader

The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files.

The Phaser.Game object has a default loader instance via the .load property

Page 16: Phaser presentation

Phaser.Tilemap“this is where the cool stuff starts”

the main class to build our tile map

Page 17: Phaser presentation

Tiledhttp://www.mapeditor.org/

a free and easy to use map editor

Page 18: Phaser presentation

Phaser.Sprite to create our game objects almost all game elements/objects/characters will be

Phaser.Sprite objects

Phaser.AnimationManager to animate our sprites (via adding frames) the Phaser.Sprite object has a default instance via

sprite.animations

Page 19: Phaser presentation

Phaser.Input

handles input related events ex. mouse, touch, keyboard, gamepad

so many ways to use and or access this class ex. via Phaser.Game game.input.keyboard

Page 20: Phaser presentation

Phaser.Physics.Arcade,Phaser.Physics.Arcade.Body

handles collisions and motion methods the default physics engine

Page 21: Phaser presentation

Using the Physics EnginePhaser.Physics.Arcade, Phaser.Physics.Arcade.Body

enable physics on the game objects call the collision checker and pass the colliding

objects use any of the physics movement methods (instead

of manually moving your sprites)

Page 22: Phaser presentation

Listening to collision eventsPhaser.Physics.Arcade, Phaser.Physics.Arcade.Body

implement a collide callback on a collision check

Page 23: Phaser presentation

Let’s Check!The Classes that we’ll need(for our Bomberman Game)

Entry point to the game enginePhaser.Game, Phaser.Loader

A way to add Tiles Phaser.Tilemap

A way to add Game ObjectsPhaser.Sprite, Phaser.AnimationManager

Listen to Keyboard InputPhaser.Input

Detect Game Object collisionsPhaser.Physics.Arcade, Phaser.Physics.Arcade.Body

Page 24: Phaser presentation

completed sample game:http://patriciatestjs.comxa.com/html5/phaser/bomberman/

End