SlideShare a Scribd company logo
1 of 37
Download to read offline
Beginning HTML5 Mobile
                   Game Programming
                           with jQuery Mobile




Saturday, October 13, 12
spkr8.com/t/16001
                            Please Rate This Talk




Saturday, October 13, 12
Twitter handle:
                           @therockncoder


Saturday, October 13, 12
The Rock n Coder
                     • http://therockncoder.blogspot.com
                     • http://www.youtube.com/user/rockncoder
                     • https://github.com/Rockncoder
                     • http://www.slideshare.net/rockncoder



Saturday, October 13, 12
Google+ Hangout on Air
                     • Tuesday, October 16th at 6 PM PDT
                     • The first of four session on HTML5 Game
                           Programming
                     • Each will complete the Game further
                     • The final session we will ‘PhoneGap’ the
                           Game
                     • Free
Saturday, October 13, 12
jssaturday.com
                           Nov. 10th, Long Beach Convention
                                         Center
                            Discount code: RiaConsultingLLC
                                       Save $65!!!



Saturday, October 13, 12
What We Won’t Cover?
                     • 3D Graphics
                     • Audio
                     • Multiplayer




Saturday, October 13, 12
What We Will Cover?
                     •     HTML5 vs Device Apps
                     •     Why jQuery Mobile?
                     •     HTML5 Canvas
                     •     A Sprite is not a Soda Pop
                     •     Collision Detection
                     •     Input
                     •     Debugging


Saturday, October 13, 12
HTML5                  Device Apps

                 Can migrate web skills       Longer learning curve
    2D only (WebGL doesn’t count)                   2D or 3D
                   Difficult to monetize      Monetization is built-in
              Restricted device access    Full access to device hardware
                           Slower                    Faster




Saturday, October 13, 12
Why jQuery Mobile?



Saturday, October 13, 12
A unified, HTML5-based user interface system for all
    popular mobile device platforms, built on the rock-solid
    jQuery and jQuery UI foundation. Its lightweight code is built
    with progressive enhancement, and has a flexible, easily
    theme-able design. 

    Requires jQuery.




Saturday, October 13, 12
Why jQuery Mobile?
                     • jQuery Mobile used as a framework
                     • Follows normal HTML syntax
                     • Easy page navigation
                     • Standardizes input events
                     • I am lazy


Saturday, October 13, 12
JavaScript Notes



Saturday, October 13, 12
JavaScript Notes
                     • Single threaded
                     • Functions are first class constructs
                     • Functions can be passed
                     • Objects are dynamic
                     • Program must return control to the
                           browser or be shut down



Saturday, October 13, 12
HTML5 Canvas



Saturday, October 13, 12
HTML5 Canvas
                 The canvas element provides scripts with a
                 resolution-dependent bitmap canvas, which can be
                 used for rendering graphs, game graphics, art, or
                 other visual images on the fly




Saturday, October 13, 12
A Sprite is not a Soda
                                    Pop




Saturday, October 13, 12
A Sprite is not a Soda
                                    Pop
                     • A Sprite is...
                     • Sprite sheet / map
                     • Sprite object
                     • Sprite Engine



Saturday, October 13, 12
A Sprite is...
                 A two-dimensional image or animation that is
                 integrated into a larger scene




Saturday, October 13, 12
A sprite sheet or map
                     • Collection of sprites in a single graphics file
                     • Reduces number individual file to download
                     • Makes it easier to maintain and modify
                           assets




Saturday, October 13, 12
A sprite sheet or map




Saturday, October 13, 12
Sprite object
                     • JavaScript - functions serve as Object
                           constructors
                     • Invoked with the new operator
                     • Never call the constructor function directly



Saturday, October 13, 12
Sprite Engine
                     • Building a game using individual objects
                           would be very cumbersome
                     • Three parts
                      • Sprite Map
                      • Draw Method
                      • Sprites

Saturday, October 13, 12
Drawing
                     • Save the context
                     • Move the origin to the center of the sprite
                     • Perform transforms
                     • Draw the sprite
                     • Restore the context


Saturday, October 13, 12
Collision Detection



Saturday, October 13, 12
Collision Detection
                     • True Collision Detection
                     • Pseudo Collision Detection
                     • Pseudo is faster




Saturday, October 13, 12
True Collision Detection
                     • Detects actual pixels of the sprites
                           overlapping
                     • Very time consuming without hardware
                           support




Saturday, October 13, 12
Pseudo Collision
                              Detection
                     • Looks for bounding boxes overlapping
                     • Or circles intersecting
                     • Is much faster than true collision detection




Saturday, October 13, 12
Input



Saturday, October 13, 12
Input
                     • Mobile devices don’t have keyboards or
                           mice
                     • We use the ‘touchstart’ event
                     • And the ‘click’ event for desktop support
                     • Input is associate with the player
                     • Actually fairly simple to do

Saturday, October 13, 12
Debugging



Saturday, October 13, 12
Debugging
                     • The Challenge
                     • Google and Apple to the Rescue
                     • Demo




Saturday, October 13, 12
References



Saturday, October 13, 12
The Rock n Coder
                     • http://therockncoder.blogspot.com
                     • http://www.youtube.com/user/rockncoder
                     • https://github.com/Rockncoder
                     • http://www.slideshare.net/rockncoder



Saturday, October 13, 12
Resources
                     • http://jquerymobile.com/
                     • http://www.html5rocks.com/en/
                     • http://www.widgetworx.com/widgetworx/
                           portfolio/spritelib.html
                     • http://devmag.org.za/2009/04/13/basic-
                           collision-detection-in-2d-part-1/



Saturday, October 13, 12
Next Steps



Saturday, October 13, 12
Next Steps
                     • Download the code
                     • Add sound and other enhancements
                     • Join me on Google+ for more game making
                           presentations




Saturday, October 13, 12

More Related Content

More from Troy Miles

Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application TestingTroy Miles
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?Troy Miles
 
Angular Weekend
Angular WeekendAngular Weekend
Angular WeekendTroy Miles
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN StackTroy Miles
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScriptTroy Miles
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in ClojureTroy Miles
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-upTroy Miles
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You KnewTroy Miles
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Troy Miles
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutesTroy Miles
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEANTroy Miles
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveXTroy Miles
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1Troy Miles
 
AngularJS Beginner Day One
AngularJS Beginner Day OneAngularJS Beginner Day One
AngularJS Beginner Day OneTroy Miles
 
AngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic FrameworkAngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic FrameworkTroy Miles
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsTroy Miles
 
Cross Platform Game Programming with Cocos2d-js
Cross Platform Game Programming with Cocos2d-jsCross Platform Game Programming with Cocos2d-js
Cross Platform Game Programming with Cocos2d-jsTroy Miles
 
10 Groovy Little JavaScript Tips
10 Groovy Little JavaScript Tips10 Groovy Little JavaScript Tips
10 Groovy Little JavaScript TipsTroy Miles
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkTroy Miles
 

More from Troy Miles (20)

Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
 
ReactJS.NET
ReactJS.NETReactJS.NET
ReactJS.NET
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You Knew
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
 
AngularJS Beginner Day One
AngularJS Beginner Day OneAngularJS Beginner Day One
AngularJS Beginner Day One
 
AngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic FrameworkAngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic Framework
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
 
Cross Platform Game Programming with Cocos2d-js
Cross Platform Game Programming with Cocos2d-jsCross Platform Game Programming with Cocos2d-js
Cross Platform Game Programming with Cocos2d-js
 
10 Groovy Little JavaScript Tips
10 Groovy Little JavaScript Tips10 Groovy Little JavaScript Tips
10 Groovy Little JavaScript Tips
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic Framework
 

Recently uploaded

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Recently uploaded (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Beginning HTML5 Mobile Game Programming with jQuery Mobile

  • 1. Beginning HTML5 Mobile Game Programming with jQuery Mobile Saturday, October 13, 12
  • 2. spkr8.com/t/16001 Please Rate This Talk Saturday, October 13, 12
  • 3. Twitter handle: @therockncoder Saturday, October 13, 12
  • 4. The Rock n Coder • http://therockncoder.blogspot.com • http://www.youtube.com/user/rockncoder • https://github.com/Rockncoder • http://www.slideshare.net/rockncoder Saturday, October 13, 12
  • 5. Google+ Hangout on Air • Tuesday, October 16th at 6 PM PDT • The first of four session on HTML5 Game Programming • Each will complete the Game further • The final session we will ‘PhoneGap’ the Game • Free Saturday, October 13, 12
  • 6. jssaturday.com Nov. 10th, Long Beach Convention Center Discount code: RiaConsultingLLC Save $65!!! Saturday, October 13, 12
  • 7. What We Won’t Cover? • 3D Graphics • Audio • Multiplayer Saturday, October 13, 12
  • 8. What We Will Cover? • HTML5 vs Device Apps • Why jQuery Mobile? • HTML5 Canvas • A Sprite is not a Soda Pop • Collision Detection • Input • Debugging Saturday, October 13, 12
  • 9. HTML5 Device Apps Can migrate web skills Longer learning curve 2D only (WebGL doesn’t count) 2D or 3D Difficult to monetize Monetization is built-in Restricted device access Full access to device hardware Slower Faster Saturday, October 13, 12
  • 11. A unified, HTML5-based user interface system for all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation. Its lightweight code is built with progressive enhancement, and has a flexible, easily theme-able design.  Requires jQuery. Saturday, October 13, 12
  • 12. Why jQuery Mobile? • jQuery Mobile used as a framework • Follows normal HTML syntax • Easy page navigation • Standardizes input events • I am lazy Saturday, October 13, 12
  • 14. JavaScript Notes • Single threaded • Functions are first class constructs • Functions can be passed • Objects are dynamic • Program must return control to the browser or be shut down Saturday, October 13, 12
  • 16. HTML5 Canvas The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, art, or other visual images on the fly Saturday, October 13, 12
  • 17. A Sprite is not a Soda Pop Saturday, October 13, 12
  • 18. A Sprite is not a Soda Pop • A Sprite is... • Sprite sheet / map • Sprite object • Sprite Engine Saturday, October 13, 12
  • 19. A Sprite is... A two-dimensional image or animation that is integrated into a larger scene Saturday, October 13, 12
  • 20. A sprite sheet or map • Collection of sprites in a single graphics file • Reduces number individual file to download • Makes it easier to maintain and modify assets Saturday, October 13, 12
  • 21. A sprite sheet or map Saturday, October 13, 12
  • 22. Sprite object • JavaScript - functions serve as Object constructors • Invoked with the new operator • Never call the constructor function directly Saturday, October 13, 12
  • 23. Sprite Engine • Building a game using individual objects would be very cumbersome • Three parts • Sprite Map • Draw Method • Sprites Saturday, October 13, 12
  • 24. Drawing • Save the context • Move the origin to the center of the sprite • Perform transforms • Draw the sprite • Restore the context Saturday, October 13, 12
  • 26. Collision Detection • True Collision Detection • Pseudo Collision Detection • Pseudo is faster Saturday, October 13, 12
  • 27. True Collision Detection • Detects actual pixels of the sprites overlapping • Very time consuming without hardware support Saturday, October 13, 12
  • 28. Pseudo Collision Detection • Looks for bounding boxes overlapping • Or circles intersecting • Is much faster than true collision detection Saturday, October 13, 12
  • 30. Input • Mobile devices don’t have keyboards or mice • We use the ‘touchstart’ event • And the ‘click’ event for desktop support • Input is associate with the player • Actually fairly simple to do Saturday, October 13, 12
  • 32. Debugging • The Challenge • Google and Apple to the Rescue • Demo Saturday, October 13, 12
  • 34. The Rock n Coder • http://therockncoder.blogspot.com • http://www.youtube.com/user/rockncoder • https://github.com/Rockncoder • http://www.slideshare.net/rockncoder Saturday, October 13, 12
  • 35. Resources • http://jquerymobile.com/ • http://www.html5rocks.com/en/ • http://www.widgetworx.com/widgetworx/ portfolio/spritelib.html • http://devmag.org.za/2009/04/13/basic- collision-detection-in-2d-part-1/ Saturday, October 13, 12
  • 37. Next Steps • Download the code • Add sound and other enhancements • Join me on Google+ for more game making presentations Saturday, October 13, 12