Please correct me if I’m wrong here, but I was looking for a method or property to retrieve the boundaries of a DisplayObject in EaselJS – however I was not able to find it – so I wrote my own method for this, maybe this will help someone and hopefully a method like this will be implemented into the framework in the future. If someone knows about the existence of such a method, please post it in the comments, so I can update this post.
Update (12-06-2012): I updated the snipped to work with the current easelJS version, it also includes rotation now.
Update (03-14-2013): Please refer to the following library: https://github.com/olsn/Collision-Detection-for-EaselJS it contains the getBounds()-method and is regularly updated and contains bugfixes
Editors Note: The tutorial is a little bit outdated now, but it still works. However if you would like to learn more on this topic and get a more detailed verison plus all the extras and resources, you should check out my ebook: From Zero to the Appstore – Blueprints for an HTML5 Game.
Here I’m starting a series of 4 articles on how to create a small game with EaselJS that “can” run on your mobile device (unfortunately it won’t run on all mobile devices) – however I also plan on a future posting on how to use technologies like cocoonJS to create a WELL-PERFORMING native app from this.
The FINAL result
The result is going to look similar to this (but with better code!) – In case you take a look at the source-code: This is NOT a good example on how to code cleanly – I did this as a quick mashup to try out a few things. – You can also do another jump, while in the air:
To test this on your mobile device, point your mobile browser to: http://demos.indiegamr.com/jumpy Continue reading