SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
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

Más contenido relacionado

Similar a Build your own game with html5

MongoDB For C++ Developers
MongoDB For C++ DevelopersMongoDB For C++ Developers
MongoDB For C++ DevelopersYnon 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 GherkinPhase2
 
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 DevelopmentSadaf 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 ThingsJesse Cravens
 

Similar a 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
 

Más de 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 heavenYohan 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 optimizationYohan Totting
 
Delivering Product Experiences
Delivering Product ExperiencesDelivering Product Experiences
Delivering Product ExperiencesYohan Totting
 
Combining api to build new thing
Combining api to build new thingCombining api to build new thing
Combining api to build new thingYohan Totting
 
Practical Mobile App Development
Practical Mobile App DevelopmentPractical Mobile App Development
Practical Mobile App DevelopmentYohan Totting
 
Digital music database
Digital music databaseDigital music database
Digital music databaseYohan 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 appYohan 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 FirefoxYohan Totting
 
Masa Depan Aplikasi Mobile
Masa Depan Aplikasi MobileMasa Depan Aplikasi Mobile
Masa Depan Aplikasi MobileYohan Totting
 
WordPress MVC Framework
WordPress MVC FrameworkWordPress MVC Framework
WordPress MVC FrameworkYohan Totting
 

Más de 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
 

Último

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Último (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

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