SlideShare a Scribd company logo
BUILD YOUR OWN GAME
                       WITH HTML5
                              Yohan Totting
                           ThinkRooms Studio
                                @tyohan

Saturday, February 2, 13
HALO
                           Yohan Totting

                           Application Developer
                           Founder of ThinkRooms Studio
                           FOWAB & HackerspaceBDG
                           Initiator




Saturday, February 2, 13
HTML5 GAME COMPONENTS




Saturday, February 2, 13
AUDIO


                           HTML5 Audio
                               +
                            Audio API


Saturday, February 2, 13
CANVAS
    canvas = document.getElementById('canvas');
    ctx = canvas.getContext('2d');

                             OR
    <canvas id=”game-canvas”></canvas>




Saturday, February 2, 13
SPRITE
   sprite = new Image();
   sprite.src = 'sprite.png';

   ctx.drawImage(sprite,srcX,srcY,frameWidth,frameHeight,frameX,frame
   Y,renderWidth,renderHeight);


                                  frame




Saturday, February 2, 13
ANIMATING SPRITE
   sprite = new Image();
   sprite.src = 'sprite.png';

   function update(){
     //check if object is moving
     if(moving===true){
       //move to next frame
       srcX=srcX+frameWidth;

             //reset frame when it reach last frame
             if(srcX>srcWidth){
                 srcX=0;
             }
        }
   }

   function draw(){
     ctx.drawImage(sprite,srcX,srcY,srcWidth,srcHeight,frameX,frameY,f
     rameWidth,frameHeight);
     }

Saturday, February 2, 13
BOX
                                    BoxA
             COLLISION                       BoxB
             DETECTION

             if((BoxA.x + BoxA.width >= BoxB.x) &&
             (BoxB.x + BoxB.width >= BoxA.x)
             &&
             ((BoxA.y + BoxA.height >= BoxB.y) &&
             (BoxB.y + BoxB.height >= BoxA.y)){
               hit();
             }

Saturday, February 2, 13
FLOW

                           Setup()

                                      CheckCollation()
                           Update()   UpdateScore()
                                      Animate()

                           Draw()


Saturday, February 2, 13
GAME ENGINE



                              LimeJS




Saturday, February 2, 13
TRY IT!


          http://j.mp/fdhtml5game

              https://blog.mozilla.org/labs/2012/07/webgamestub-
              or-so-you-want-a-quick-start-on-a-2d-canvas-game/



Saturday, February 2, 13
CREATE YOUR OWN GAME!

                                 Yohan Totting
                              ThinkRooms Studio
                                   @tyohan
                           tyohan@thinkrooms.com



Saturday, February 2, 13

More Related Content

Similar to Build your own game with html5

What's new in Rails5?
What's new in Rails5?What's new in Rails5?
What's new in Rails5?
Fernand Galiana
 
MongoDB For C++ Developers
MongoDB For C++ DevelopersMongoDB For C++ Developers
MongoDB For C++ Developers
Ynon Perek
 
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
Jason Rhodes
 
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
Jason Rhodes
 
Testing Drupal with Ghosts and Gherkin
Testing Drupal  with Ghosts and GherkinTesting Drupal  with Ghosts and Gherkin
Testing Drupal with Ghosts and Gherkin
Phase2
 
Bucc Toy Project: Learn programming through Game Development
Bucc  Toy Project: Learn programming through Game DevelopmentBucc  Toy Project: Learn programming through Game Development
Bucc Toy Project: Learn programming through Game Development
Sadaf Noor
 
HTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of Things
HTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of ThingsHTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of Things
HTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of Things
Jesse Cravens
 
Playing With Ruby
Playing With RubyPlaying With Ruby
Playing With Ruby
Sau Sheong Chang
 

Similar to Build your own game with html5 (11)

What's new in Rails5?
What's new in Rails5?What's new in Rails5?
What's new in Rails5?
 
MongoDB For C++ Developers
MongoDB For C++ DevelopersMongoDB For C++ Developers
MongoDB For C++ Developers
 
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
 
Wphackergalaxy
WphackergalaxyWphackergalaxy
Wphackergalaxy
 
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
 
Testing Drupal with Ghosts and Gherkin
Testing Drupal  with Ghosts and GherkinTesting Drupal  with Ghosts and Gherkin
Testing Drupal with Ghosts and Gherkin
 
Bucc Toy Project: Learn programming through Game Development
Bucc  Toy Project: Learn programming through Game DevelopmentBucc  Toy Project: Learn programming through Game Development
Bucc Toy Project: Learn programming through Game Development
 
04 Reports
04 Reports04 Reports
04 Reports
 
HTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of Things
HTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of ThingsHTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of Things
HTML5.tx 2013: Embedded JavaScript, HTML5 and the Internet of Things
 
Play 2 pip
Play 2 pipPlay 2 pip
Play 2 pip
 
Playing With Ruby
Playing With RubyPlaying With Ruby
Playing With Ruby
 

More from Yohan Totting

Native is not the only way to heaven
Native is not the only way to heavenNative is not the only way to heaven
Native is not the only way to heaven
Yohan Totting
 
Gone in 4 seconds web performance optimization
Gone in 4 seconds   web performance optimizationGone in 4 seconds   web performance optimization
Gone in 4 seconds web performance optimization
Yohan Totting
 
Delivering Product Experiences
Delivering Product ExperiencesDelivering Product Experiences
Delivering Product Experiences
Yohan Totting
 
Combining api to build new thing
Combining api to build new thingCombining api to build new thing
Combining api to build new thing
Yohan Totting
 
Practical Mobile App Development
Practical Mobile App DevelopmentPractical Mobile App Development
Practical Mobile App Development
Yohan Totting
 
Build Your MVP
Build Your MVPBuild Your MVP
Build Your MVP
Yohan Totting
 
FingerJobs
FingerJobsFingerJobs
FingerJobs
Yohan Totting
 
Digital music database
Digital music databaseDigital music database
Digital music database
Yohan Totting
 
Thinkrooms Portfolio
Thinkrooms Portfolio Thinkrooms Portfolio
Thinkrooms Portfolio
Yohan Totting
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive app
Yohan Totting
 
The Future of Web App with Firefox
The Future of Web App with FirefoxThe Future of Web App with Firefox
The Future of Web App with Firefox
Yohan Totting
 
Masa Depan Aplikasi Mobile
Masa Depan Aplikasi MobileMasa Depan Aplikasi Mobile
Masa Depan Aplikasi Mobile
Yohan Totting
 
WordPress MVC Framework
WordPress MVC FrameworkWordPress MVC Framework
WordPress MVC Framework
Yohan Totting
 

More from Yohan Totting (13)

Native is not the only way to heaven
Native is not the only way to heavenNative is not the only way to heaven
Native is not the only way to heaven
 
Gone in 4 seconds web performance optimization
Gone in 4 seconds   web performance optimizationGone in 4 seconds   web performance optimization
Gone in 4 seconds web performance optimization
 
Delivering Product Experiences
Delivering Product ExperiencesDelivering Product Experiences
Delivering Product Experiences
 
Combining api to build new thing
Combining api to build new thingCombining api to build new thing
Combining api to build new thing
 
Practical Mobile App Development
Practical Mobile App DevelopmentPractical Mobile App Development
Practical Mobile App Development
 
Build Your MVP
Build Your MVPBuild Your MVP
Build Your MVP
 
FingerJobs
FingerJobsFingerJobs
FingerJobs
 
Digital music database
Digital music databaseDigital music database
Digital music database
 
Thinkrooms Portfolio
Thinkrooms Portfolio Thinkrooms Portfolio
Thinkrooms Portfolio
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive app
 
The Future of Web App with Firefox
The Future of Web App with FirefoxThe Future of Web App with Firefox
The Future of Web App with Firefox
 
Masa Depan Aplikasi Mobile
Masa Depan Aplikasi MobileMasa Depan Aplikasi Mobile
Masa Depan Aplikasi Mobile
 
WordPress MVC Framework
WordPress MVC FrameworkWordPress MVC Framework
WordPress MVC Framework
 

Recently uploaded

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 

Recently uploaded (20)

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 

Build your own game with html5

  • 1. BUILD YOUR OWN GAME WITH HTML5 Yohan Totting ThinkRooms Studio @tyohan Saturday, February 2, 13
  • 2. HALO Yohan Totting Application Developer Founder of ThinkRooms Studio FOWAB & HackerspaceBDG Initiator Saturday, February 2, 13
  • 4. AUDIO HTML5 Audio + Audio API Saturday, February 2, 13
  • 5. CANVAS canvas = document.getElementById('canvas'); ctx = canvas.getContext('2d'); OR <canvas id=”game-canvas”></canvas> Saturday, February 2, 13
  • 6. SPRITE sprite = new Image(); sprite.src = 'sprite.png'; ctx.drawImage(sprite,srcX,srcY,frameWidth,frameHeight,frameX,frame Y,renderWidth,renderHeight); frame Saturday, February 2, 13
  • 7. ANIMATING SPRITE sprite = new Image(); sprite.src = 'sprite.png'; function update(){ //check if object is moving if(moving===true){ //move to next frame srcX=srcX+frameWidth; //reset frame when it reach last frame if(srcX>srcWidth){ srcX=0; } } } function draw(){ ctx.drawImage(sprite,srcX,srcY,srcWidth,srcHeight,frameX,frameY,f rameWidth,frameHeight); } Saturday, February 2, 13
  • 8. BOX BoxA COLLISION BoxB DETECTION if((BoxA.x + BoxA.width >= BoxB.x) && (BoxB.x + BoxB.width >= BoxA.x) && ((BoxA.y + BoxA.height >= BoxB.y) && (BoxB.y + BoxB.height >= BoxA.y)){   hit(); } Saturday, February 2, 13
  • 9. FLOW Setup() CheckCollation() Update() UpdateScore() Animate() Draw() Saturday, February 2, 13
  • 10. GAME ENGINE LimeJS Saturday, February 2, 13
  • 11. TRY IT! http://j.mp/fdhtml5game https://blog.mozilla.org/labs/2012/07/webgamestub- or-so-you-want-a-quick-start-on-a-2d-canvas-game/ Saturday, February 2, 13
  • 12. CREATE YOUR OWN GAME! Yohan Totting ThinkRooms Studio @tyohan tyohan@thinkrooms.com Saturday, February 2, 13