The Monkey version for TimelineFX has been in beta for a while now and it’s pretty much feature complete bar a few bugs that will probably crop up here and there. It’s not actually based on the Blitzmax version directly ie., I didn’t base the code and class structure on it, I actually wrote it from scratch for Monkey. Despite that though, if you compare the usage of each one they’re pretty much the same, and anyone who has used the Blitzmax version will feel very little difference in the Monkey version.
For anyone who hasn’t got the faintest idea what I’m going on about, Monkey is a relatively new language that can be translated into other languages for compiling on a whole range of platforms, such as iPhone, Android, Windows, Linux and so on, visit the Monkey website for more information.
You can grab the source code from SVN here, however I’ll probably move it to git somewhere in the near future. Once again as per the Blitzmax version it’s released royalty free under the MIT license.
For an example of it’s usage so you can see how easy it is to implement, here’s the code of the example that comes with it.
'The minimum we need to import is mojo and of course timelinefx! Import mojo Import timelinefx 'Create a simple Monky App Class Class FXexample Extends App 'Create some fields to store an effects libray, effect, and a particle manager. Field MyEffects:tlEffectsLibrary Field MyEffect:tlEffect Field MyParticleManager:tlParticleManager 'In the OnCreate method you can load your effects 'library and set up the particle manager. Method OnCreate() 'load the effects file. See the docs on LoadEffects on how to 'prepare an effects library for use in monkey. MyEffects = LoadEffects("explosions") 'Use GetEffect, to retrieve an effect from the library. MyEffect = MyEffects.GetEffect("toon explosion 2") 'create a particle manager to manage all the effects and particles MyParticleManager = CreateParticleManager(5000) 'Set the number of times per second that you want the particles to 'be updated. Best to set this to the UpdateRate SetUpdateFrequency(30) 'Let the Particle manager know the screen size MyParticleManager.SetScreenSize(DeviceWidth(), DeviceHeight()) 'Set the origin so that we can use mouse coords to place effects on screen MyParticleManager.SetOrigin(DeviceWidth() / 2, DeviceHeight() / 2) 'Mojo update rate SetUpdateRate 30 End 'Use the OnUpdate method to update the particle manager Method OnUpdate() 'lets create an effect everytime the mouse is clicked If MouseHit 'Copy the effect *Important! Dont just add an effect directly from the 'library, make a copy of it first* Local tempeffect:tlEffect = CopyEffect(MyEffect, MyParticleManager) 'Position the effect where we want it tempeffect.SetPosition(MouseX, MouseY) 'Add the effect to the particle manager MyParticleManager.AddEffect(tempeffect) tempeffect.SetZ(1) EndIf 'Update the particle manager MyParticleManager.Update() End 'Use the OnRender method to render all particles Method OnRender() Cls 'draw the particles MyParticleManager.DrawParticles() End End Function Main() New FXexample End
Nice and simple 🙂