*Requires Corona Build 243 at the very least.
Download it here: BeebeGamesClass.zip
This is my BeebeGames Class , which provides a lot of useful functions for games. It started out as my way of creating display objects as quickly as possible.
Simple, Pauseable Animation
For those who use movieclips, this should be a breathe of fresh air because animation can be easily started, stopped, paused/resumed, and you can set the interval between frames. If you just need an object with multiple images (or just one), this can also provide that.
Basic Transition Pausing/Resuming
Also, it provides a basic form of linear transitions (modify the x, y, xScale, yScale values) which can be PAUSED and RESUMED easily by simply setting the .isActive variable to true/false.
Useful Game-Related Functions
Each object you create with the BeebeGames class will provide you a few new methods you’re not used to having access to, such as:
[blockcode]
object:move( x, y ) --> move object relative to current location
object:moveTowards( x, y [, increment]) --> move towards specific point; default increment is 1 (pixel)
object:getAngleTo( x, y ) --> Get angle from object to specified location
object:getDistanceTo( x, y ) --> returns distance (in pixels) from object to specified location
object:destroy() --> removes event listener, calls removeSelf, and then garbage collects
[/blockcode]
Retina Display Text
There’s an included retinaDisplayText() function which should completely replace the existing newText function.
And a few others…
commaThousands() will return a large number with commas separating the thousands digits.
saveValue() will easily save a value to a single-line file.
loadValue() will easily load a value from a saved file, or create it if it doesn’t exist.
I made this class for myself to use in my own projects, so it’s not perfect (nor is the included documentation that exists in the comments section at the beginning of the module), so feel free to expand on it and tweak it to fit your needs.
Enjoy!
Jonathan Beebe
http://jonbeebe.tumblr.com/
http://beebegamesonline.appspot.com/
P.S. If anyone cares to make an example demonstrating all of the functions of this class, please share it by posting the download link to the example in the comments thread. I don’t have an example handy at the moment, but I did test everything as I added it to the class. Also, not guaranteed to be bug-free, but it works great per my personal testing thus far.
[import]uid: 7849 topic_id: 4474 reply_id: 304474[/import]
