@fs2020 Could you give us some info about what gives you trouble about adding the effects to your game?
It should be pretty simple, just load the effects you need when you intitialize your game:
// include the particle addon
// initialize the particle system (this will load the particle geometry , the noise textures, etc)
myEffect = gpup_loadEffect("effectname", x position, y position, z position, scale)
// load an effect and position it
gpup_emitterActive( myEffect, gpup_active )
// let the effect emit particles. This will basically turn the emitter on. You can ofcourse use this command at any time to turn an effect on or off.
and then in your game loop:
// update the particles
If it's a triggered effect like an explosion that doesn't emit continuously, then you can use gpup_emitterFire(myEffect)
to trigger it to fire the amount of particles you have specified in the editor.
Your game might ofcourse need several explosions at different places, for that you can reuse one effect and easily reposition it without moving already emitted particles from older explosions: gpup_setGlobalPivot( myEffect, x position, y position, z position )
Just make sure the emit count is set low enough that you have enough particles for several simultanious explosions and you are set.
Here is the complete code of an AppGameKit program that loads and displays an effect created in the editor:
myEffect1 as integer
// Initialie AGK rendering
// Include the particle addon
// Initialize the particle system
myEffect1 = gpup_loadEffect("animrunner2", 0, 0, 0, 1.0) // load an effect at position 0,0,0
gpup_emitterActive( myEffect1, gpup_active) // activate the effect
// Main loop
Print("Active effects: "+str(gpup_settings.activeEffects))
// Update the particle system. Call this every refresh.
if ( GetRawKeyState(27) ) then exit
sx as integer
sy as integer
sx = GetMaxDeviceWidth()*0.7
sy = GetMaxDeviceHeight()*0.7
SetWindowTitle( "Runtime Demo" )
SetAntialiasMode( 1 )
SetWindowSize( sx, sy, 0)
UseNewDefaultFonts( 1 )
SetPrintSize( 20 )
SetGenerateMipmaps( 1 )
SetSyncRate( 0, 0 )
setcamerarange(1, 0.01, 650)
SetClearColor( 55,88,100 )
SetCameraPosition( 1, 0, 0.8, -4.5 )
SetCameraLookAt(1, 0, 0.5, 0, 0)
Most of that code is just the standard AppGameKit initialization. Only the few commands I described above are particle related.
Some 2D helper functions are in the new update. It's ready to be sent out, but unfortunately the Vulkan/Metal stuff causes some issues with the effects in iOS exports (looks like a precision issue), so that needs to be ironed out first. On the bright side, hopefully future users using custom shaders and iOS targets will not have to deal with the same issues.