SlideShare a Scribd company logo
1 of 23
CreateJS library to build
HTML5 + JS Games
Jorge Solis @solisarg
ar.linkedin.com/in/jorgealbertosolis
solisarg@gmail.com
createJS library
Easel JS
A Javascript library
that makes working
with the HTML5
Canvas element
easy.
TweenJS
A Javascript
library for
tweening and
animating HTML5
and Javascript
properties.
SoundsJS
A Javascript library
that provides a
simple API, and
powerful features to
make working with
audio a breeze.
Preload JS
A Javascript library
that lets you manage
and co-ordinate the
loading of assets.
C&S Practices
Short history
CreateJS is a suite of modular libraries and tools which work together to
enable rich interactive content on open web technologies via HTML5.
These libraries are designed to work completely independently, or mixed
and matched to suit your needs. The CreateJS Suite is comprised
of:EaselJS, TweenJS, SoundJS, PreloadJS, and Zoë.
Gaming
C&S Practices
Short history
EaselJS provides straight forward solutions for working with rich graphics
and interactivity with HTML5 Canvas. It provides an API that is familiar to
Flash developers, but embraces Javascript sensibilities. It consists of a full,
hierarchical display list, a core interaction model, and helper classes to
make working with Canvas much easier.
Gaming
EaselJS API
Gaming
TweenJS
Short history
TweenJS is a simple tweening library for use in Javascript. It was
developed to integrate well with the EaselJS library, but is not dependent
on or specific to it. It supports tweening of both numeric object
properties & CSS style properties. The API is simple but very powerful,
making it easy to create complex tweens by chaining commands.
Gaming
EaselJS API
Gaming
Simple alpha tweening from 0 to 1 and a callback
Chainable tweening with callback
C&S Practices
Short history
Consistant cross-browser support for audio is currently a mess in HTML5,
but SoundJS works to abstract away the problems and makes adding
sound to your games or rich experiences much easier. You can query for
capabilities, then specify and prioritize what APIs, plugins, and features
are leveraged for specific devices or browsers.
Gaming
SoundJS API
Gaming
Load a sound and play in a callback
C&S Practices
Short history
PreloadJS makes it easy to preload your assets:images, sounds, JS, data,
or others. It uses XHR2 to provide real progress information when
available, or fall back to tag loading and eased progress when it isn’t. It
allows multiple queues, multiple connections, pausing queues, and a lot
more.
Gaming
PreloadJS API Breadcrumb | Breadcrumb02 | Breadcrumb03
GamingLoad a queue with different media
GAMES
Let’s talk about
games !!
Gaming common elements
Elements
• Loading Screen
• Splash Screen
• Screen stack
• Hero
• Enemies and EnemyManager
• Score System and Live Feedback
• User input: keyboard, mouse, touch
• Main game Loop
• Animations and SpriteSheets
• Events Vs Direct calls
Loading screen
Loading screen
On this screen tipically all graphis and sounds assets are preloaded so the user
could have a soft experience when playing our game
Game.loader = new createjs.LoadQueue(false);
Game.loader.addEventListener("progress", handleProgress);
Game.loader.addEventListener("complete", handleComplete);
Game.loader.addEventListener("error", handleFileError);
Game.loader.installPlugin(createjs.Sound);
Game.loader.loadManifest(manifest);
Splash screen
• All assets are loaded and ready to go
• Entry point for the game, ads, options, general presentation
Splash screen
• All assets are loaded and ready to go
• Entry point for the game, ads, options, general presentation
SplashScreen.prototype.createScreen = function(){
//create a rectangle to serve as solid color background
var stageDim = new createjs.Rectangle(0, 0, this.game.stage.canvas.width, this.game.stage.canvas.height);
var shape = new createjs.Shape();
shape.graphics.beginFill("#4D598E").drawRect(0, 0, stageDim.width, stageDim.height);
this.game.stage.addChild(shape);
(...)
//Create a play button using a pre-existing art
var jugar = new createjs.Sprite(this.logo, "jugar");
var jugarDim = jugar.getBounds();
jugar.x = stageDim.width - (jugarDim.width+10)
jugar.y = titulo.y + tituloDim.height + 50;
this.game.stage.addChild(jugar);
(...)
//wait for Click
jugar.addEventListener("click", new createjs.proxy(this.game.inicia, this.game) );
this.game.stage.update();
}
Screen Manager
• Manage screen stack and transitions
ScreenManager = function(game) {
this.initialize(game);
}
var p = ScreenManager.prototype = new createjs.Sprite();
p.createScreens = function() {
//create background pieces
this.screens = [new createjs.Bitmap("assets/fondo1.png"),new
createjs.Bitmap("assets/fondo2.png"), new createjs.Bitmap("assets/fondo3.png"), new
createjs.Bitmap("assets/fondo4.png"), new createjs.Bitmap("assets/fondo5.png"), new
createjs.Bitmap("assets/fondo6.png"), new createjs.Bitmap("assets/fondo7.png"), new
createjs.Bitmap("assets/fondo8.png"),new createjs.Bitmap("assets/fondo9.png"), new
createjs.Bitmap("assets/fondo10.png")];
//names for debugging
for(i = 0; i<this.screens.length; i++) this.screens[i].name = "screen"+(i+1)
}
Hero
• Hero is the main character of the game
• Usualy there’s a dedicated class to manage hero
features that are the most complex
marco_p.game; //reference to the world
marco_p.speed; //motion speed
marco_p.live = 12; //remaining power
marco_p.vidas = 3; //total lives
marco_p.block = null; //timeout for punch
marco_p.lastKey; //last key pressed
marco_p.keyListener; //listener fo user input
marco_p.comboCounter = 0; //special punch counter
marco_p.side = 1; //right 1, left 0
marco_p.spriteSheet; //sprisheet with basic animactions
marco_p.enemy; //EnemyManager
marco_p.screen; //ScreenManager
marco_p.bar; //LiveBar
marco_p.punchCounter = 0;
marco_p.power = 0; //special from powerups
Enemies
• Enemies have some kind of AI
• Enemies are grouped by characteristics and usually there’s
a manager that controls quantity, speed, etc
Enemy Manager class initialization
p.initialize = function(game){
//reference to the main game
this.game = game;
createjs.EventDispatcher.initialize(EnemyManager.prototype);
//list of enemies at each level
this.screens = new Array(["gatoarana1"], ["gatoarana1", "gatoarana1"], ["gatoarana1",
"gatoarana2", "bateador2"], ["gatoarana1", "bateador1", "bateador1"] , ["bateador1", "gatoarana2",
"gatoarana2"] , ["gatoarana2", "gatoarana2", "bateador2", "bateador2"] , ["gatoarana2", "gatoarana2",
"bateador2", "bateador1"], ["bateador1", "bateador1", "gatoarana2", "gatoarana2"], ["gatoarana1",
"gatoarana1", "bateador2", "bateador2"], ["gatote"]);
//markups for the final scene and boss fight
this.golpesFinal = [1, 12, 18, 24, 30, 36, 42, 48];
//pool of enemies
this.enemies = [];
//tick for check events
this.tick = new Timer();
}
User input
• User input manages keys, mouse, taps, joysticks or
whatever element the user interacts to control the game
heroe_p.handleKeyDown = function(evt){
//console.log("evt.keyCode "+evt.keyCode);
switch(evt.keyCode) {
case 37:
if (this.x > 80) this.x -= this.speed;
if (this.lastKey != 37) {
this.scaleX = -this.origScale;
}
break;
case 39:
if (this.x < 515) this.x += this.speed;
if (this.lastKey != 39) {
this.scaleX = this.origScale;
}
break;
}
if(this.currentFrame==0) this.gotoAndPlay("camina");this.lastKey =
evt.keyCode;}
Main game Loop
• Since multiple elements should move, be checked, disapear and interact over the
time, a single loop to update everything is the ideal in term of performance
p.setupUpdateLoop = function() {
if(!this.inited){
createjs.Ticker.on("tick", this.tick, this);
createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED ;
createjs.Ticker.setFPS(60);
}
}
Main Class Game
• Check hardware and software environment (identify device and OS)
• Load of graphic and sound assets
• Creation of managers (screen, enemies, energy/life)
• Creation of the Splash screen
• Public functions of high level that needs global visibility
• Reference to each classes so they can use the main class game as a bridge
• Global variables and configuration that need to be easily available
createJS library
Easel JS
A Javascript library
that makes working
with the HTML5
Canvas element
easy.
TweenJS
A Javascript
library for
tweening and
animating HTML5
and Javascript
properties.
SoundsJS
A Javascript library
that provides a
simple API, and
powerful features to
make working with
audio a breeze.
Preload JS
A Javascript library
that lets you manage
and co-ordinate the
loading of assets.

More Related Content

What's hot

Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x EngineDuy Tan Geek
 
Game development via_sprite_kit
Game development via_sprite_kitGame development via_sprite_kit
Game development via_sprite_kitBuşra Deniz, CSM
 
Introduction to Unity3D and Building your First Game
Introduction to Unity3D and Building your First GameIntroduction to Unity3D and Building your First Game
Introduction to Unity3D and Building your First GameSarah Sexton
 
The Ring programming language version 1.9 book - Part 70 of 210
The Ring programming language version 1.9 book - Part 70 of 210The Ring programming language version 1.9 book - Part 70 of 210
The Ring programming language version 1.9 book - Part 70 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 71 of 212
The Ring programming language version 1.10 book - Part 71 of 212The Ring programming language version 1.10 book - Part 71 of 212
The Ring programming language version 1.10 book - Part 71 of 212Mahmoud Samir Fayed
 
JoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflowJoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflowJoshgrey16
 
Academy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentAcademy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentBinary Studio
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsNick Pruehs
 
What Would Blizzard Do
What Would Blizzard DoWhat Would Blizzard Do
What Would Blizzard DoNick Pruehs
 
cpbricks project document
cpbricks project documentcpbricks project document
cpbricks project documenti i
 
Thoughts on MongoDB Analytics
Thoughts on MongoDB AnalyticsThoughts on MongoDB Analytics
Thoughts on MongoDB Analyticsrogerbodamer
 
Callum deighton engine terminology
Callum deighton engine terminologyCallum deighton engine terminology
Callum deighton engine terminologyDeightonater
 
A-Rage AGDC (The Australian Game Developers Conference)
A-Rage AGDC (The Australian Game Developers Conference)A-Rage AGDC (The Australian Game Developers Conference)
A-Rage AGDC (The Australian Game Developers Conference)JT Velikovsky
 
Nighthawk Controller
Nighthawk ControllerNighthawk Controller
Nighthawk ControllerBen Speer
 
Clickable DIVs and other icebergs
Clickable DIVs and other icebergsClickable DIVs and other icebergs
Clickable DIVs and other icebergsBen Buchanan
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with UnityPetri Lankoski
 
watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話Kohki Miki
 

What's hot (20)

Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x Engine
 
Game development via_sprite_kit
Game development via_sprite_kitGame development via_sprite_kit
Game development via_sprite_kit
 
Introduction to Unity3D and Building your First Game
Introduction to Unity3D and Building your First GameIntroduction to Unity3D and Building your First Game
Introduction to Unity3D and Building your First Game
 
The Ring programming language version 1.9 book - Part 70 of 210
The Ring programming language version 1.9 book - Part 70 of 210The Ring programming language version 1.9 book - Part 70 of 210
The Ring programming language version 1.9 book - Part 70 of 210
 
The Ring programming language version 1.10 book - Part 71 of 212
The Ring programming language version 1.10 book - Part 71 of 212The Ring programming language version 1.10 book - Part 71 of 212
The Ring programming language version 1.10 book - Part 71 of 212
 
JoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflowJoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflow
 
Academy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentAcademy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. Environment
 
Game dev 101 part 3
Game dev 101 part 3Game dev 101 part 3
Game dev 101 part 3
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
What Would Blizzard Do
What Would Blizzard DoWhat Would Blizzard Do
What Would Blizzard Do
 
cpbricks project document
cpbricks project documentcpbricks project document
cpbricks project document
 
Game dev 101 part 2
Game dev 101   part 2Game dev 101   part 2
Game dev 101 part 2
 
Thoughts on MongoDB Analytics
Thoughts on MongoDB AnalyticsThoughts on MongoDB Analytics
Thoughts on MongoDB Analytics
 
Callum deighton engine terminology
Callum deighton engine terminologyCallum deighton engine terminology
Callum deighton engine terminology
 
A-Rage AGDC (The Australian Game Developers Conference)
A-Rage AGDC (The Australian Game Developers Conference)A-Rage AGDC (The Australian Game Developers Conference)
A-Rage AGDC (The Australian Game Developers Conference)
 
Nighthawk Controller
Nighthawk ControllerNighthawk Controller
Nighthawk Controller
 
Clickable DIVs and other icebergs
Clickable DIVs and other icebergsClickable DIVs and other icebergs
Clickable DIVs and other icebergs
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
 
watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話
 
Game age ppt
Game age pptGame age ppt
Game age ppt
 

Similar to Build HTML5 games with the CreateJS libraries

XNA And Silverlight
XNA And SilverlightXNA And Silverlight
XNA And SilverlightAaron King
 
Introduction to html5 game programming with impact js
Introduction to html5 game programming with impact jsIntroduction to html5 game programming with impact js
Introduction to html5 game programming with impact jsLuca Galli
 
Game Development With HTML5
Game Development With HTML5Game Development With HTML5
Game Development With HTML5Gil Megidish
 
Beginning android games
Beginning android gamesBeginning android games
Beginning android gamesMario Zechner
 
Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...benjaoming
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?Ankara JUG
 
The Ring programming language version 1.5.4 book - Part 48 of 185
The Ring programming language version 1.5.4 book - Part 48 of 185The Ring programming language version 1.5.4 book - Part 48 of 185
The Ring programming language version 1.5.4 book - Part 48 of 185Mahmoud Samir Fayed
 
Writing videogames with titanium appcelerator
Writing videogames with titanium appceleratorWriting videogames with titanium appcelerator
Writing videogames with titanium appceleratorAlessio Ricco
 
Game programming with Groovy
Game programming with GroovyGame programming with Groovy
Game programming with GroovyJames Williams
 
Android game development
Android game developmentAndroid game development
Android game developmentdmontagni
 
Y1 gd engine_terminologY
Y1 gd engine_terminologYY1 gd engine_terminologY
Y1 gd engine_terminologYElliotBlack
 
Cameron mc rae y1 gd_engineterminology no videos
Cameron mc rae y1 gd_engineterminology no videosCameron mc rae y1 gd_engineterminology no videos
Cameron mc rae y1 gd_engineterminology no videosCameronMcRae901
 
jQuery Foot-Gun Features
jQuery Foot-Gun FeaturesjQuery Foot-Gun Features
jQuery Foot-Gun Featuresdmethvin
 
An introduction to the create js suite
An introduction to the create js suiteAn introduction to the create js suite
An introduction to the create js suiteScott Ackerman
 

Similar to Build HTML5 games with the CreateJS libraries (20)

XNA And Silverlight
XNA And SilverlightXNA And Silverlight
XNA And Silverlight
 
Introduction to html5 game programming with impact js
Introduction to html5 game programming with impact jsIntroduction to html5 game programming with impact js
Introduction to html5 game programming with impact js
 
Game Development With HTML5
Game Development With HTML5Game Development With HTML5
Game Development With HTML5
 
Beginning android games
Beginning android gamesBeginning android games
Beginning android games
 
Real life XNA
Real life XNAReal life XNA
Real life XNA
 
Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 
The Ring programming language version 1.5.4 book - Part 48 of 185
The Ring programming language version 1.5.4 book - Part 48 of 185The Ring programming language version 1.5.4 book - Part 48 of 185
The Ring programming language version 1.5.4 book - Part 48 of 185
 
Engine terminology
Engine terminologyEngine terminology
Engine terminology
 
Writing videogames with titanium appcelerator
Writing videogames with titanium appceleratorWriting videogames with titanium appcelerator
Writing videogames with titanium appcelerator
 
Game programming with Groovy
Game programming with GroovyGame programming with Groovy
Game programming with Groovy
 
Android game development
Android game developmentAndroid game development
Android game development
 
Y1 gd engine_terminologY
Y1 gd engine_terminologYY1 gd engine_terminologY
Y1 gd engine_terminologY
 
Cameron mc rae y1 gd_engineterminology no videos
Cameron mc rae y1 gd_engineterminology no videosCameron mc rae y1 gd_engineterminology no videos
Cameron mc rae y1 gd_engineterminology no videos
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
jQuery Foot-Gun Features
jQuery Foot-Gun FeaturesjQuery Foot-Gun Features
jQuery Foot-Gun Features
 
An introduction to the create js suite
An introduction to the create js suiteAn introduction to the create js suite
An introduction to the create js suite
 
Md2010 jl-wp7-sl-game-dev
Md2010 jl-wp7-sl-game-devMd2010 jl-wp7-sl-game-dev
Md2010 jl-wp7-sl-game-dev
 

Recently uploaded

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Recently uploaded (20)

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

Build HTML5 games with the CreateJS libraries

  • 1. CreateJS library to build HTML5 + JS Games Jorge Solis @solisarg ar.linkedin.com/in/jorgealbertosolis solisarg@gmail.com
  • 2. createJS library Easel JS A Javascript library that makes working with the HTML5 Canvas element easy. TweenJS A Javascript library for tweening and animating HTML5 and Javascript properties. SoundsJS A Javascript library that provides a simple API, and powerful features to make working with audio a breeze. Preload JS A Javascript library that lets you manage and co-ordinate the loading of assets.
  • 3. C&S Practices Short history CreateJS is a suite of modular libraries and tools which work together to enable rich interactive content on open web technologies via HTML5. These libraries are designed to work completely independently, or mixed and matched to suit your needs. The CreateJS Suite is comprised of:EaselJS, TweenJS, SoundJS, PreloadJS, and Zoë. Gaming
  • 4. C&S Practices Short history EaselJS provides straight forward solutions for working with rich graphics and interactivity with HTML5 Canvas. It provides an API that is familiar to Flash developers, but embraces Javascript sensibilities. It consists of a full, hierarchical display list, a core interaction model, and helper classes to make working with Canvas much easier. Gaming
  • 6. TweenJS Short history TweenJS is a simple tweening library for use in Javascript. It was developed to integrate well with the EaselJS library, but is not dependent on or specific to it. It supports tweening of both numeric object properties & CSS style properties. The API is simple but very powerful, making it easy to create complex tweens by chaining commands. Gaming
  • 7. EaselJS API Gaming Simple alpha tweening from 0 to 1 and a callback Chainable tweening with callback
  • 8. C&S Practices Short history Consistant cross-browser support for audio is currently a mess in HTML5, but SoundJS works to abstract away the problems and makes adding sound to your games or rich experiences much easier. You can query for capabilities, then specify and prioritize what APIs, plugins, and features are leveraged for specific devices or browsers. Gaming
  • 9. SoundJS API Gaming Load a sound and play in a callback
  • 10. C&S Practices Short history PreloadJS makes it easy to preload your assets:images, sounds, JS, data, or others. It uses XHR2 to provide real progress information when available, or fall back to tag loading and eased progress when it isn’t. It allows multiple queues, multiple connections, pausing queues, and a lot more. Gaming
  • 11. PreloadJS API Breadcrumb | Breadcrumb02 | Breadcrumb03 GamingLoad a queue with different media
  • 13. Gaming common elements Elements • Loading Screen • Splash Screen • Screen stack • Hero • Enemies and EnemyManager • Score System and Live Feedback • User input: keyboard, mouse, touch • Main game Loop • Animations and SpriteSheets • Events Vs Direct calls
  • 14. Loading screen Loading screen On this screen tipically all graphis and sounds assets are preloaded so the user could have a soft experience when playing our game Game.loader = new createjs.LoadQueue(false); Game.loader.addEventListener("progress", handleProgress); Game.loader.addEventListener("complete", handleComplete); Game.loader.addEventListener("error", handleFileError); Game.loader.installPlugin(createjs.Sound); Game.loader.loadManifest(manifest);
  • 15. Splash screen • All assets are loaded and ready to go • Entry point for the game, ads, options, general presentation
  • 16. Splash screen • All assets are loaded and ready to go • Entry point for the game, ads, options, general presentation SplashScreen.prototype.createScreen = function(){ //create a rectangle to serve as solid color background var stageDim = new createjs.Rectangle(0, 0, this.game.stage.canvas.width, this.game.stage.canvas.height); var shape = new createjs.Shape(); shape.graphics.beginFill("#4D598E").drawRect(0, 0, stageDim.width, stageDim.height); this.game.stage.addChild(shape); (...) //Create a play button using a pre-existing art var jugar = new createjs.Sprite(this.logo, "jugar"); var jugarDim = jugar.getBounds(); jugar.x = stageDim.width - (jugarDim.width+10) jugar.y = titulo.y + tituloDim.height + 50; this.game.stage.addChild(jugar); (...) //wait for Click jugar.addEventListener("click", new createjs.proxy(this.game.inicia, this.game) ); this.game.stage.update(); }
  • 17. Screen Manager • Manage screen stack and transitions ScreenManager = function(game) { this.initialize(game); } var p = ScreenManager.prototype = new createjs.Sprite(); p.createScreens = function() { //create background pieces this.screens = [new createjs.Bitmap("assets/fondo1.png"),new createjs.Bitmap("assets/fondo2.png"), new createjs.Bitmap("assets/fondo3.png"), new createjs.Bitmap("assets/fondo4.png"), new createjs.Bitmap("assets/fondo5.png"), new createjs.Bitmap("assets/fondo6.png"), new createjs.Bitmap("assets/fondo7.png"), new createjs.Bitmap("assets/fondo8.png"),new createjs.Bitmap("assets/fondo9.png"), new createjs.Bitmap("assets/fondo10.png")]; //names for debugging for(i = 0; i<this.screens.length; i++) this.screens[i].name = "screen"+(i+1) }
  • 18. Hero • Hero is the main character of the game • Usualy there’s a dedicated class to manage hero features that are the most complex marco_p.game; //reference to the world marco_p.speed; //motion speed marco_p.live = 12; //remaining power marco_p.vidas = 3; //total lives marco_p.block = null; //timeout for punch marco_p.lastKey; //last key pressed marco_p.keyListener; //listener fo user input marco_p.comboCounter = 0; //special punch counter marco_p.side = 1; //right 1, left 0 marco_p.spriteSheet; //sprisheet with basic animactions marco_p.enemy; //EnemyManager marco_p.screen; //ScreenManager marco_p.bar; //LiveBar marco_p.punchCounter = 0; marco_p.power = 0; //special from powerups
  • 19. Enemies • Enemies have some kind of AI • Enemies are grouped by characteristics and usually there’s a manager that controls quantity, speed, etc Enemy Manager class initialization p.initialize = function(game){ //reference to the main game this.game = game; createjs.EventDispatcher.initialize(EnemyManager.prototype); //list of enemies at each level this.screens = new Array(["gatoarana1"], ["gatoarana1", "gatoarana1"], ["gatoarana1", "gatoarana2", "bateador2"], ["gatoarana1", "bateador1", "bateador1"] , ["bateador1", "gatoarana2", "gatoarana2"] , ["gatoarana2", "gatoarana2", "bateador2", "bateador2"] , ["gatoarana2", "gatoarana2", "bateador2", "bateador1"], ["bateador1", "bateador1", "gatoarana2", "gatoarana2"], ["gatoarana1", "gatoarana1", "bateador2", "bateador2"], ["gatote"]); //markups for the final scene and boss fight this.golpesFinal = [1, 12, 18, 24, 30, 36, 42, 48]; //pool of enemies this.enemies = []; //tick for check events this.tick = new Timer(); }
  • 20. User input • User input manages keys, mouse, taps, joysticks or whatever element the user interacts to control the game heroe_p.handleKeyDown = function(evt){ //console.log("evt.keyCode "+evt.keyCode); switch(evt.keyCode) { case 37: if (this.x > 80) this.x -= this.speed; if (this.lastKey != 37) { this.scaleX = -this.origScale; } break; case 39: if (this.x < 515) this.x += this.speed; if (this.lastKey != 39) { this.scaleX = this.origScale; } break; } if(this.currentFrame==0) this.gotoAndPlay("camina");this.lastKey = evt.keyCode;}
  • 21. Main game Loop • Since multiple elements should move, be checked, disapear and interact over the time, a single loop to update everything is the ideal in term of performance p.setupUpdateLoop = function() { if(!this.inited){ createjs.Ticker.on("tick", this.tick, this); createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED ; createjs.Ticker.setFPS(60); } }
  • 22. Main Class Game • Check hardware and software environment (identify device and OS) • Load of graphic and sound assets • Creation of managers (screen, enemies, energy/life) • Creation of the Splash screen • Public functions of high level that needs global visibility • Reference to each classes so they can use the main class game as a bridge • Global variables and configuration that need to be easily available
  • 23. createJS library Easel JS A Javascript library that makes working with the HTML5 Canvas element easy. TweenJS A Javascript library for tweening and animating HTML5 and Javascript properties. SoundsJS A Javascript library that provides a simple API, and powerful features to make working with audio a breeze. Preload JS A Javascript library that lets you manage and co-ordinate the loading of assets.