HTML5 Game Development Tutorial: Handling Collisions with Generic Methods | packtpub.com

1,084 views · Published 31 December 2013 · 2:28 · Indexed 19 October 2026

Channel: Packt · 2013 · Science & Technology

Watch on YouTube

Part of 'HTML5 Game Development' video series. For the full Course visit:
http://www.packtpub.com/html5-game-development/video?utm_source=youtube&utm_medium=video-description&utm_campaign=yt-html5game

Detecting collisions between the hero and platform or the hero and obstacles is similar - we can create that code as a generic collision-detection method.

1. Implement a new method named gameObjectHitsHero and invoke the callback function when a collision is detected 
2. Replace the existing platform and obstacle collision code with the new method tailored to a given category of the game object 
3. Group the object-collision code into a method named resolveCollision 

-------------------------------------------------------------------------------------------

For the latest in game development video tutorials, please visit:
http://www.packtpub.com/books/video?utm_source=youtube&utm_medium=video-description&utm_campaign=yt-html5game

Find us on Facebook -- http://www.facebook.com/Packtvideo
Follow us on Twitter - http://www.twitter.com/packtvideo

More from this channel