SlideShare uma empresa Scribd logo
1 de 29
Introduction to HTML5 game development (with Phaser)
valerio.riva@gmail.com
@ValerioRiva
http://it.linkedin.com/in/valerioriva/
Valerio «Lotti» Riva
Who am I?
• Web developer @ past life
• Game developer @ Interactive Project
• MyGPTeam (http://www.mygpteam.com/)
• MyGPTeam Turbo (http://www.mygpteam.com/turbo/)
• OverVolt: crazy slot cars (coming soon!)
ROME 11-12 april 2014 – Valerio Riva
2
Intro
• Core game development concepts
• Phaser: Desktop and Mobile HTML5 game
framework
• Few useful tools
• Deployment
ROME 11-12 april 2014 – Valerio Riva
3
HTML5 is the new Flash
• No plugin needed!
• Available on all mobile devices
• Low performances on almost
every mobile devices
(especially on Android)
• Flash game frameworks ported
to HTML5 (Flixel -> Phaser!)
ROME 11-12 april 2014 – Valerio Riva
4
To develop an HTML5 game you
need…
• Any OS
• Any editor
• Any web server
Or you can just use Brackets! http://brackets.io/
ROME 11-12 april 2014 – Valerio Riva
5
Phaser (http://phaser.io/)
• Easy to use 2D game framework
• Focused on mobile
• Use pixi.js for WebGL & Canvas rendering
(http://www.pixijs.com/)
• Supports WebAudio & HTML Audio
• Various physics engine supported
• “arcade”: simple AABB physics engine
• p2.js: complete physics engine
(http://schteppe.github.io/p2.js/)
ROME 11-12 april 2014 – Valerio Riva
6
Core Game Development
Concepts
• Loop
• Sprite
• Tilemap
• Collision
• Input
ROME 11-12 april 2014 – Valerio Riva
7
do { game } while (true);
• The hearth of the game
• update loop executes game logic
• Inputs, AI, collisions… your game is computed here!
• rendering loop draws graphic elements to screen
• Phaser game implementation
• Game is a set of states
• Each state has its own loops
• rendering loop is supplied by pixi.js
ROME 11-12 april 2014 – Valerio Riva
8
Phaser game state
Main functions:
• preload: used to load assets
• create: state initialization
• update: the real game loop
• render: called after rendering. Use it for debugging and
post-rendering purposes
• Other function:
• pause: called when the game is paused (on focus loss)
• shutdown: called when leaving a state
• …
ROME 11-12 april 2014 – Valerio Riva
9
Hello Phaser!
ROME 11-12 april 2014 – Valerio Riva
10
Deployment
Web
• Any hosting!
• Game portals
• http://gamepix.com
• http://kongregate.com
• http://armorgames.com
Mobile
• Cordova (Phonegap)
• Intel XDK
• Accelerated webview
• CocoonJS
• Accelerated webview
• API for
Ads, IAP, accelerometer,
etc.
ROME 11-12 april 2014 –
Valerio Riva
11
Sprite
“In computer graphics, a sprite is a two-
dimensional image or animation that is
integrated into a larger scene.”
• Has a set of coordinates
and sizes
• Can be animated with
sequential drawings
• Main actor of a 2D game
ROME 11-12 april 2014 – Valerio Riva
12
• Be created
• Scale
• Rotate
• Moves
• Animate
• Have physic body
for collisions
• and much more!
var s = game.add.sprite(x,y, "image");
s.scale.setTo(0.75,0.75);
s.angle=180 / s.rotation=3.141
s.x += 10; s.y -= 10;
s.animations.play("walk",fps);
game.physics.arcade.enable(s);
ROME 11-12 april 2014 – Valerio Riva
What sprites can do
ROME 11-12 april 2014 –
Valerio Riva
13
Group of sprites
• Use it as z-ordered layer
• Use it for fast pooling and object recycling too
• Can apply transformation to all sprites of the group
• Can call methods on all sprites of the group
var group = game.add.group();
var sprite = group.create(x, y, 'image');
group.x += 100;
group.callAll('kill');
var zombie = group.getFirstExists(false);
zombie.revive(); //cured!
ROME 11-12 april 2014 – Valerio Riva
14
Tilesprite
“A tilesprite is a sprite that has a repeating texture.”
var tilesprite =
game.add.tileSprite(0, 0, 32, 64, 'image');
• texture can be scrolled
tilesprite.tilePosition.setTo(10,20);
• texture can be scaled
tilesprite.tileScale.setTo(1.5,1.5);
ROME 11-12 april 2014 – Valerio Riva
15
Tilemap
ROME 11-12 april 2014 – Valerio Riva
16
Tilemap
A tilemap is a map composed by a fixed number of
same sized sprites (tiles)
• Each tile can have different behavior
• Used to create platform and map based games
• Can be orthogonal or isometric
• Easy to create with Tiled
(http://www.mapeditor.org/)
ROME 11-12 april 2014 – Valerio Riva
17
Tilemap
function preload() {
game.load.tilemap('codem', 'tilemap/codem.json', n
ull, Phaser.Tilemap.TILED_JSON);
game.load.image('block', 'sprites/block.gif');
}
function create() {
map = game.add.tilemap("codem");
map.addTilesetImage("block");
map.setCollisionByExclusion([]);
layer = map.createLayer("codemotion");
layer.resizeWorld();
}
ROME 11-12 april 2014 – Valerio Riva
18
Collision
“A collision is an instance of one moving object touching
another.”
• Both object must have a “body” (collider)
• Object can be a sprite or a tilemap or even a group!
• A body can be a rectangle, a circle or a polygon
• Bodies can have a lot of properties
(mass, gravity, velocity, material, …)
• Last two statements depends on what physics engine
you are using.
• More complex is the engine, more computation is
needed. Choose wisely!
ROME 11-12 april 2014 – Valerio Riva
19
Collision
function create() {
game.physics.startSystem(Phaser.Physics.ARCADE);
sprite = game.add.sprite(0, 0, 'image');
game.physics.enable(sprite, Phaser.Physics.ARCADE);
sprite.body.collideWorldBounds = true;
sprite.body.bounce.set(1);
}
function update() {
game.physics.arcade.collide(sprite, [tilemap, group],
function(sprite, other) { … });
}
ROME 11-12 april 2014 – Valerio Riva
20
Input
Phaser supports natively
• Keyboard
• Mouse
• Multi-touch
• Gamepads (up to four, each one with 10 axis and
16 buttons)
• Supports even Xbox 360 gamepad! (button
mapping depends on browser : )
ROME 11-12 april 2014 – Valerio Riva
21
Input: Keyboard
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
ufo.y -= 10;
}
else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
ufo.y += 10;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
ufo.x -= 10;
}
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
ufo.x += 10;
}
}
ROME 11-12 april 2014 – Valerio Riva
22
Input: Mouse
if (game.input.mousePointer.isDown) {
if (game.input.mousePointer.x < game.width*0.5) {
clickOnLeft = true;
}
else if (game.input.mousePointer.x > game.width*0.5) {
clickOnRight = true;
}
if (game.input.mousePointer.y < game.height*0.5) {
clickOnTop = true;
}
}
• Swap mousePointer with activePointer to capture
any active pointer (works with mouse and touch
inputs)
ROME 11-12 april 2014 – Valerio Riva
23
Input: Multi-touch
• Supports 10 pointers (= fingers)!
• Two pointers are already available
• Add another pointer
game.input.addPointer();
• Read different pointers
game.input.pointer3; or game.input.pointer4;
ROME 11-12 april 2014 – Valerio Riva
24
Input: Gamepad
function create() {
game.input.gamepad.start();
pad1 = game.input.gamepad.pad1;
}
function update() {
if (game.input.gamepad.supported
&& game.input.gamepad.active
&& pad1.connected) {
//play with gamepad!
if (pad1.isDown(Phaser.Gamepad.XBOX360_DPAD_LEFT)) { … }
if (pad1.axis(Phaser.Gamepad.XBOX360_STICK_LEFT_X)) { … }
if (pad1.justPressed(Phaser.Gamepad.XBOX360_A)) { … }
}
else {
//play with boring keyboard!
}
}
ROME 11-12 april 2014 – Valerio Riva
25
Dissecting the mummy
ROME 11-12 april 2014 – Valerio Riva
26
Want more?
• Take a look to another example that implements P2
physics engine (http://github.com/Lotti/phaserTut)
• Phaser examples (http://examples.phaser.io/)
• Phaser docs (http://docs.phaser.io/)
ROME 11-12 april 2014 – Valerio Riva
27
Resources & Links
• The mummy game
• P2 physics engine example
• Phaser’s forum
• http://docs.phaser.io
• http://examples.phaser.io
• http://html5gameengine.com
• http://brackets.io
• http://www.pixijs.com
• http://schteppe.github.io/p2.js
• http://www.mapeditor.org
• http://xdk-software.intel.com
• https://www.ludei.com/cocoonjs
• https://cordova.apache.org
• http://phonegap.com
ROME 11-12 april 2014 –
Valerio Riva
28
Thank you!
Any Questions?
ROME 11-12 april 2014 – Valerio Riva
29
valerio.riva@gmail.com
@ValerioRiva
http://it.linkedin.com/in/valerioriva/

Mais conteúdo relacionado

Mais procurados

Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unitydavidluzgouveia
 
The Making of PopCap's Plants vs Zombies
The Making of PopCap's Plants vs ZombiesThe Making of PopCap's Plants vs Zombies
The Making of PopCap's Plants vs ZombiesJames Gwertzman
 
Web Game Development
Web Game DevelopmentWeb Game Development
Web Game DevelopmentSabin Buraga
 
Game Development Step by Step
Game Development Step by StepGame Development Step by Step
Game Development Step by StepBayu Sembada
 
Audio and Video streaming.ppt
Audio and Video streaming.pptAudio and Video streaming.ppt
Audio and Video streaming.pptVideoguy
 
Best Practices in Mobile Game Testing
Best Practices in Mobile Game TestingBest Practices in Mobile Game Testing
Best Practices in Mobile Game TestingBitbar
 
Introduction-to-Unity.ppt
Introduction-to-Unity.pptIntroduction-to-Unity.ppt
Introduction-to-Unity.pptGravityboi
 
12 Principles Of Animations
12 Principles Of Animations12 Principles Of Animations
12 Principles Of AnimationsDaniel Downs
 
3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv Nizan
3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv Nizan3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv Nizan
3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv NizanJessica Tams
 
A sample Lab report on a game.
A sample Lab report on a game. A sample Lab report on a game.
A sample Lab report on a game. Junayed Ahmed
 
Adobe Premiere Tutorial
Adobe Premiere TutorialAdobe Premiere Tutorial
Adobe Premiere Tutorialsamharlow
 
Multimedia system and hardware devices
Multimedia system and hardware devices Multimedia system and hardware devices
Multimedia system and hardware devices Abhay Kumar
 
User Experience 4: Usable User Interface
User Experience 4: Usable User InterfaceUser Experience 4: Usable User Interface
User Experience 4: Usable User InterfaceMarc Miquel
 
Game Development workshop with Unity3D.
Game Development workshop with Unity3D.Game Development workshop with Unity3D.
Game Development workshop with Unity3D.Ebtihaj khan
 
Adobe Premiere Pro: An Introduction to the Basics
Adobe Premiere Pro: An Introduction to the BasicsAdobe Premiere Pro: An Introduction to the Basics
Adobe Premiere Pro: An Introduction to the BasicsRichard Harrington
 

Mais procurados (18)

Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unity
 
Video Streaming
Video StreamingVideo Streaming
Video Streaming
 
The Making of PopCap's Plants vs Zombies
The Making of PopCap's Plants vs ZombiesThe Making of PopCap's Plants vs Zombies
The Making of PopCap's Plants vs Zombies
 
Web Game Development
Web Game DevelopmentWeb Game Development
Web Game Development
 
Game Development Step by Step
Game Development Step by StepGame Development Step by Step
Game Development Step by Step
 
Multimedia
MultimediaMultimedia
Multimedia
 
Audio and Video streaming.ppt
Audio and Video streaming.pptAudio and Video streaming.ppt
Audio and Video streaming.ppt
 
Best Practices in Mobile Game Testing
Best Practices in Mobile Game TestingBest Practices in Mobile Game Testing
Best Practices in Mobile Game Testing
 
Introduction-to-Unity.ppt
Introduction-to-Unity.pptIntroduction-to-Unity.ppt
Introduction-to-Unity.ppt
 
12 Principles Of Animations
12 Principles Of Animations12 Principles Of Animations
12 Principles Of Animations
 
3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv Nizan
3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv Nizan3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv Nizan
3 Useful Case Studies from Hyper-Casual Games and Ad-Funded Apps | Yaniv Nizan
 
A sample Lab report on a game.
A sample Lab report on a game. A sample Lab report on a game.
A sample Lab report on a game.
 
Unity 3d Basics
Unity 3d BasicsUnity 3d Basics
Unity 3d Basics
 
Adobe Premiere Tutorial
Adobe Premiere TutorialAdobe Premiere Tutorial
Adobe Premiere Tutorial
 
Multimedia system and hardware devices
Multimedia system and hardware devices Multimedia system and hardware devices
Multimedia system and hardware devices
 
User Experience 4: Usable User Interface
User Experience 4: Usable User InterfaceUser Experience 4: Usable User Interface
User Experience 4: Usable User Interface
 
Game Development workshop with Unity3D.
Game Development workshop with Unity3D.Game Development workshop with Unity3D.
Game Development workshop with Unity3D.
 
Adobe Premiere Pro: An Introduction to the Basics
Adobe Premiere Pro: An Introduction to the BasicsAdobe Premiere Pro: An Introduction to the Basics
Adobe Premiere Pro: An Introduction to the Basics
 

Destaque

Making HTML5 Games with Phaser
Making HTML5 Games with PhaserMaking HTML5 Games with Phaser
Making HTML5 Games with PhaserIndieOutpost
 
VlbgWebDev Mai 2015 - Game Design PT 1
VlbgWebDev Mai 2015 - Game Design PT 1VlbgWebDev Mai 2015 - Game Design PT 1
VlbgWebDev Mai 2015 - Game Design PT 1Johannes Moser
 
硅谷早期投资趋势
硅谷早期投资趋势硅谷早期投资趋势
硅谷早期投资趋势Rui Ma
 
Keep your game in the fun zone - Designing an AI Director
Keep your game in the fun zone - Designing an AI DirectorKeep your game in the fun zone - Designing an AI Director
Keep your game in the fun zone - Designing an AI DirectorIndieOutpost
 
Juice up your game feel!
Juice up your game feel!Juice up your game feel!
Juice up your game feel!IndieOutpost
 
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...Pablo Farías Navarro
 
La ecuación de Batman
La ecuación de BatmanLa ecuación de Batman
La ecuación de BatmanJesus Garcia
 
Flappy Bird Game Dev by Phaser Framework
Flappy Bird Game Dev by Phaser FrameworkFlappy Bird Game Dev by Phaser Framework
Flappy Bird Game Dev by Phaser FrameworkRyan Chung
 
Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014Alvinsight
 
Making Native Browser Games in The Modern Age
Making Native Browser Games in The Modern AgeMaking Native Browser Games in The Modern Age
Making Native Browser Games in The Modern AgeCatt Small
 
Lasertron lt 12 vs zone nexus fec
Lasertron lt 12 vs zone nexus fecLasertron lt 12 vs zone nexus fec
Lasertron lt 12 vs zone nexus fecejeffers2010
 
HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015
HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015
HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015Pablo Farías Navarro
 
Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...
Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...
Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...Himanshu Sharan
 
我的敏捷测试宣言(Agile Testing Manifesto)
我的敏捷测试宣言(Agile Testing Manifesto)我的敏捷测试宣言(Agile Testing Manifesto)
我的敏捷测试宣言(Agile Testing Manifesto)Xudong Yu
 
跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...
跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...
跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...Rui Ma
 

Destaque (20)

Phaser presentation
Phaser presentationPhaser presentation
Phaser presentation
 
Making HTML5 Games with Phaser
Making HTML5 Games with PhaserMaking HTML5 Games with Phaser
Making HTML5 Games with Phaser
 
Introduction to Phaser.js
Introduction to Phaser.jsIntroduction to Phaser.js
Introduction to Phaser.js
 
VlbgWebDev Mai 2015 - Game Design PT 1
VlbgWebDev Mai 2015 - Game Design PT 1VlbgWebDev Mai 2015 - Game Design PT 1
VlbgWebDev Mai 2015 - Game Design PT 1
 
硅谷早期投资趋势
硅谷早期投资趋势硅谷早期投资趋势
硅谷早期投资趋势
 
Keep your game in the fun zone - Designing an AI Director
Keep your game in the fun zone - Designing an AI DirectorKeep your game in the fun zone - Designing an AI Director
Keep your game in the fun zone - Designing an AI Director
 
Juice up your game feel!
Juice up your game feel!Juice up your game feel!
Juice up your game feel!
 
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
 
La ecuación de Batman
La ecuación de BatmanLa ecuación de Batman
La ecuación de Batman
 
Flappy Bird Game Dev by Phaser Framework
Flappy Bird Game Dev by Phaser FrameworkFlappy Bird Game Dev by Phaser Framework
Flappy Bird Game Dev by Phaser Framework
 
Html5 game development
Html5 game developmentHtml5 game development
Html5 game development
 
Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014
 
Making Native Browser Games in The Modern Age
Making Native Browser Games in The Modern AgeMaking Native Browser Games in The Modern Age
Making Native Browser Games in The Modern Age
 
Marketing 360 - 2011
Marketing 360 - 2011Marketing 360 - 2011
Marketing 360 - 2011
 
Lasertron lt 12 vs zone nexus fec
Lasertron lt 12 vs zone nexus fecLasertron lt 12 vs zone nexus fec
Lasertron lt 12 vs zone nexus fec
 
HTML5 Game Development frameworks overview
HTML5 Game Development frameworks overviewHTML5 Game Development frameworks overview
HTML5 Game Development frameworks overview
 
HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015
HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015
HTML5 Mobile Game Development - Brisbane Game Technology Meetup 2015
 
Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...
Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...
Multi-platform Compatibility of HTML5 by developing simple HTML5 based game(M...
 
我的敏捷测试宣言(Agile Testing Manifesto)
我的敏捷测试宣言(Agile Testing Manifesto)我的敏捷测试宣言(Agile Testing Manifesto)
我的敏捷测试宣言(Agile Testing Manifesto)
 
跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...
跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...
跨境10年 - The Next Decade of US China Crossborder Early Stage Tech Venture Inve...
 

Semelhante a Introduction to HTML5 game development (with Phaser)

Scrivere Webapp per Firefox OS - Orru
Scrivere Webapp per Firefox OS - OrruScrivere Webapp per Firefox OS - Orru
Scrivere Webapp per Firefox OS - OrruCodemotion
 
Bigpoint: Game of Thrones: Bringing Westeros to Life
Bigpoint: Game of Thrones: Bringing Westeros to LifeBigpoint: Game of Thrones: Bringing Westeros to Life
Bigpoint: Game of Thrones: Bringing Westeros to LifeDevGAMM Conference
 
Build a serverless distributed Pong game with Azure
Build a serverless distributed Pong game with AzureBuild a serverless distributed Pong game with Azure
Build a serverless distributed Pong game with AzureMarco Parenzan
 
Node meetup feb_20_12
Node meetup feb_20_12Node meetup feb_20_12
Node meetup feb_20_12jafar104
 
VR digest. July 2017
VR digest. July 2017VR digest. July 2017
VR digest. July 2017ElifTech
 
Intro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingIntro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingJames Williams
 
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...Joseph Labrecque
 
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)David Salz
 
Developing Multi Platform Games using PlayN and TriplePlay Framework
Developing Multi Platform Games using PlayN and TriplePlay FrameworkDeveloping Multi Platform Games using PlayN and TriplePlay Framework
Developing Multi Platform Games using PlayN and TriplePlay FrameworkCsaba Toth
 
Refactoring PHP/Symfony2 apps
Refactoring PHP/Symfony2 appsRefactoring PHP/Symfony2 apps
Refactoring PHP/Symfony2 appsRaul Fraile
 
Teacher Training Workshop - Game Development with Phaser
Teacher Training Workshop  - Game Development with PhaserTeacher Training Workshop  - Game Development with Phaser
Teacher Training Workshop - Game Development with PhaserPablo Farías Navarro
 
Delta Engine Multiplatform Development Presentation 2011-05
Delta Engine Multiplatform Development Presentation 2011-05Delta Engine Multiplatform Development Presentation 2011-05
Delta Engine Multiplatform Development Presentation 2011-05Benjamin Nitschke
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.ioSteven Cooper
 
Game Development with Windows Phone 7
Game Development with Windows Phone 7Game Development with Windows Phone 7
Game Development with Windows Phone 7Allan Mangune
 
VR digest. December 2017
VR digest. December 2017VR digest. December 2017
VR digest. December 2017ElifTech
 
Java 8 Launch Event - Past, Present and Future of Java and Java 8 key themes
Java 8 Launch Event - Past, Present and Future of Java and Java 8 key themesJava 8 Launch Event - Past, Present and Future of Java and Java 8 key themes
Java 8 Launch Event - Past, Present and Future of Java and Java 8 key themesLucas Jellema
 
Snake project report
Snake project reportSnake project report
Snake project reportManju Rajput
 

Semelhante a Introduction to HTML5 game development (with Phaser) (20)

Scrivere Webapp per Firefox OS - Orru
Scrivere Webapp per Firefox OS - OrruScrivere Webapp per Firefox OS - Orru
Scrivere Webapp per Firefox OS - Orru
 
Bigpoint: Game of Thrones: Bringing Westeros to Life
Bigpoint: Game of Thrones: Bringing Westeros to LifeBigpoint: Game of Thrones: Bringing Westeros to Life
Bigpoint: Game of Thrones: Bringing Westeros to Life
 
Ferguson VR Hackathon - May 6, 2017
Ferguson VR Hackathon - May 6, 2017Ferguson VR Hackathon - May 6, 2017
Ferguson VR Hackathon - May 6, 2017
 
Build a serverless distributed Pong game with Azure
Build a serverless distributed Pong game with AzureBuild a serverless distributed Pong game with Azure
Build a serverless distributed Pong game with Azure
 
Node meetup feb_20_12
Node meetup feb_20_12Node meetup feb_20_12
Node meetup feb_20_12
 
VR digest. July 2017
VR digest. July 2017VR digest. July 2017
VR digest. July 2017
 
Intro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingIntro to HTML5 Game Programming
Intro to HTML5 Game Programming
 
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
 
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
 
Developing Multi Platform Games using PlayN and TriplePlay Framework
Developing Multi Platform Games using PlayN and TriplePlay FrameworkDeveloping Multi Platform Games using PlayN and TriplePlay Framework
Developing Multi Platform Games using PlayN and TriplePlay Framework
 
XNA L01–Introduction
XNA L01–IntroductionXNA L01–Introduction
XNA L01–Introduction
 
Refactoring PHP/Symfony2 apps
Refactoring PHP/Symfony2 appsRefactoring PHP/Symfony2 apps
Refactoring PHP/Symfony2 apps
 
Teacher Training Workshop - Game Development with Phaser
Teacher Training Workshop  - Game Development with PhaserTeacher Training Workshop  - Game Development with Phaser
Teacher Training Workshop - Game Development with Phaser
 
Delta Engine Multiplatform Development Presentation 2011-05
Delta Engine Multiplatform Development Presentation 2011-05Delta Engine Multiplatform Development Presentation 2011-05
Delta Engine Multiplatform Development Presentation 2011-05
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
 
Game Development with Windows Phone 7
Game Development with Windows Phone 7Game Development with Windows Phone 7
Game Development with Windows Phone 7
 
Java8 launch at AMIS Services / First8
Java8 launch at AMIS Services / First8Java8 launch at AMIS Services / First8
Java8 launch at AMIS Services / First8
 
VR digest. December 2017
VR digest. December 2017VR digest. December 2017
VR digest. December 2017
 
Java 8 Launch Event - Past, Present and Future of Java and Java 8 key themes
Java 8 Launch Event - Past, Present and Future of Java and Java 8 key themesJava 8 Launch Event - Past, Present and Future of Java and Java 8 key themes
Java 8 Launch Event - Past, Present and Future of Java and Java 8 key themes
 
Snake project report
Snake project reportSnake project report
Snake project report
 

Último

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Último (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 

Introduction to HTML5 game development (with Phaser)

  • 1. Introduction to HTML5 game development (with Phaser) valerio.riva@gmail.com @ValerioRiva http://it.linkedin.com/in/valerioriva/ Valerio «Lotti» Riva
  • 2. Who am I? • Web developer @ past life • Game developer @ Interactive Project • MyGPTeam (http://www.mygpteam.com/) • MyGPTeam Turbo (http://www.mygpteam.com/turbo/) • OverVolt: crazy slot cars (coming soon!) ROME 11-12 april 2014 – Valerio Riva 2
  • 3. Intro • Core game development concepts • Phaser: Desktop and Mobile HTML5 game framework • Few useful tools • Deployment ROME 11-12 april 2014 – Valerio Riva 3
  • 4. HTML5 is the new Flash • No plugin needed! • Available on all mobile devices • Low performances on almost every mobile devices (especially on Android) • Flash game frameworks ported to HTML5 (Flixel -> Phaser!) ROME 11-12 april 2014 – Valerio Riva 4
  • 5. To develop an HTML5 game you need… • Any OS • Any editor • Any web server Or you can just use Brackets! http://brackets.io/ ROME 11-12 april 2014 – Valerio Riva 5
  • 6. Phaser (http://phaser.io/) • Easy to use 2D game framework • Focused on mobile • Use pixi.js for WebGL & Canvas rendering (http://www.pixijs.com/) • Supports WebAudio & HTML Audio • Various physics engine supported • “arcade”: simple AABB physics engine • p2.js: complete physics engine (http://schteppe.github.io/p2.js/) ROME 11-12 april 2014 – Valerio Riva 6
  • 7. Core Game Development Concepts • Loop • Sprite • Tilemap • Collision • Input ROME 11-12 april 2014 – Valerio Riva 7
  • 8. do { game } while (true); • The hearth of the game • update loop executes game logic • Inputs, AI, collisions… your game is computed here! • rendering loop draws graphic elements to screen • Phaser game implementation • Game is a set of states • Each state has its own loops • rendering loop is supplied by pixi.js ROME 11-12 april 2014 – Valerio Riva 8
  • 9. Phaser game state Main functions: • preload: used to load assets • create: state initialization • update: the real game loop • render: called after rendering. Use it for debugging and post-rendering purposes • Other function: • pause: called when the game is paused (on focus loss) • shutdown: called when leaving a state • … ROME 11-12 april 2014 – Valerio Riva 9
  • 10. Hello Phaser! ROME 11-12 april 2014 – Valerio Riva 10
  • 11. Deployment Web • Any hosting! • Game portals • http://gamepix.com • http://kongregate.com • http://armorgames.com Mobile • Cordova (Phonegap) • Intel XDK • Accelerated webview • CocoonJS • Accelerated webview • API for Ads, IAP, accelerometer, etc. ROME 11-12 april 2014 – Valerio Riva 11
  • 12. Sprite “In computer graphics, a sprite is a two- dimensional image or animation that is integrated into a larger scene.” • Has a set of coordinates and sizes • Can be animated with sequential drawings • Main actor of a 2D game ROME 11-12 april 2014 – Valerio Riva 12
  • 13. • Be created • Scale • Rotate • Moves • Animate • Have physic body for collisions • and much more! var s = game.add.sprite(x,y, "image"); s.scale.setTo(0.75,0.75); s.angle=180 / s.rotation=3.141 s.x += 10; s.y -= 10; s.animations.play("walk",fps); game.physics.arcade.enable(s); ROME 11-12 april 2014 – Valerio Riva What sprites can do ROME 11-12 april 2014 – Valerio Riva 13
  • 14. Group of sprites • Use it as z-ordered layer • Use it for fast pooling and object recycling too • Can apply transformation to all sprites of the group • Can call methods on all sprites of the group var group = game.add.group(); var sprite = group.create(x, y, 'image'); group.x += 100; group.callAll('kill'); var zombie = group.getFirstExists(false); zombie.revive(); //cured! ROME 11-12 april 2014 – Valerio Riva 14
  • 15. Tilesprite “A tilesprite is a sprite that has a repeating texture.” var tilesprite = game.add.tileSprite(0, 0, 32, 64, 'image'); • texture can be scrolled tilesprite.tilePosition.setTo(10,20); • texture can be scaled tilesprite.tileScale.setTo(1.5,1.5); ROME 11-12 april 2014 – Valerio Riva 15
  • 16. Tilemap ROME 11-12 april 2014 – Valerio Riva 16
  • 17. Tilemap A tilemap is a map composed by a fixed number of same sized sprites (tiles) • Each tile can have different behavior • Used to create platform and map based games • Can be orthogonal or isometric • Easy to create with Tiled (http://www.mapeditor.org/) ROME 11-12 april 2014 – Valerio Riva 17
  • 18. Tilemap function preload() { game.load.tilemap('codem', 'tilemap/codem.json', n ull, Phaser.Tilemap.TILED_JSON); game.load.image('block', 'sprites/block.gif'); } function create() { map = game.add.tilemap("codem"); map.addTilesetImage("block"); map.setCollisionByExclusion([]); layer = map.createLayer("codemotion"); layer.resizeWorld(); } ROME 11-12 april 2014 – Valerio Riva 18
  • 19. Collision “A collision is an instance of one moving object touching another.” • Both object must have a “body” (collider) • Object can be a sprite or a tilemap or even a group! • A body can be a rectangle, a circle or a polygon • Bodies can have a lot of properties (mass, gravity, velocity, material, …) • Last two statements depends on what physics engine you are using. • More complex is the engine, more computation is needed. Choose wisely! ROME 11-12 april 2014 – Valerio Riva 19
  • 20. Collision function create() { game.physics.startSystem(Phaser.Physics.ARCADE); sprite = game.add.sprite(0, 0, 'image'); game.physics.enable(sprite, Phaser.Physics.ARCADE); sprite.body.collideWorldBounds = true; sprite.body.bounce.set(1); } function update() { game.physics.arcade.collide(sprite, [tilemap, group], function(sprite, other) { … }); } ROME 11-12 april 2014 – Valerio Riva 20
  • 21. Input Phaser supports natively • Keyboard • Mouse • Multi-touch • Gamepads (up to four, each one with 10 axis and 16 buttons) • Supports even Xbox 360 gamepad! (button mapping depends on browser : ) ROME 11-12 april 2014 – Valerio Riva 21
  • 22. Input: Keyboard function update() { if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) { ufo.y -= 10; } else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { ufo.y += 10; } if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { ufo.x -= 10; } else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { ufo.x += 10; } } ROME 11-12 april 2014 – Valerio Riva 22
  • 23. Input: Mouse if (game.input.mousePointer.isDown) { if (game.input.mousePointer.x < game.width*0.5) { clickOnLeft = true; } else if (game.input.mousePointer.x > game.width*0.5) { clickOnRight = true; } if (game.input.mousePointer.y < game.height*0.5) { clickOnTop = true; } } • Swap mousePointer with activePointer to capture any active pointer (works with mouse and touch inputs) ROME 11-12 april 2014 – Valerio Riva 23
  • 24. Input: Multi-touch • Supports 10 pointers (= fingers)! • Two pointers are already available • Add another pointer game.input.addPointer(); • Read different pointers game.input.pointer3; or game.input.pointer4; ROME 11-12 april 2014 – Valerio Riva 24
  • 25. Input: Gamepad function create() { game.input.gamepad.start(); pad1 = game.input.gamepad.pad1; } function update() { if (game.input.gamepad.supported && game.input.gamepad.active && pad1.connected) { //play with gamepad! if (pad1.isDown(Phaser.Gamepad.XBOX360_DPAD_LEFT)) { … } if (pad1.axis(Phaser.Gamepad.XBOX360_STICK_LEFT_X)) { … } if (pad1.justPressed(Phaser.Gamepad.XBOX360_A)) { … } } else { //play with boring keyboard! } } ROME 11-12 april 2014 – Valerio Riva 25
  • 26. Dissecting the mummy ROME 11-12 april 2014 – Valerio Riva 26
  • 27. Want more? • Take a look to another example that implements P2 physics engine (http://github.com/Lotti/phaserTut) • Phaser examples (http://examples.phaser.io/) • Phaser docs (http://docs.phaser.io/) ROME 11-12 april 2014 – Valerio Riva 27
  • 28. Resources & Links • The mummy game • P2 physics engine example • Phaser’s forum • http://docs.phaser.io • http://examples.phaser.io • http://html5gameengine.com • http://brackets.io • http://www.pixijs.com • http://schteppe.github.io/p2.js • http://www.mapeditor.org • http://xdk-software.intel.com • https://www.ludei.com/cocoonjs • https://cordova.apache.org • http://phonegap.com ROME 11-12 april 2014 – Valerio Riva 28
  • 29. Thank you! Any Questions? ROME 11-12 april 2014 – Valerio Riva 29 valerio.riva@gmail.com @ValerioRiva http://it.linkedin.com/in/valerioriva/