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

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

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