(AGK version: 2)
Submitted: 2023-04-18 08:01:24
// Project: use loadsubimage for billboard animated
// Created: 2023-04-16
// code by virtual nomad

// show all errors
SetErrorMode(2)

// set window properties
SetWindowSize(800,600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 800,600) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts


Texture = LoadImage("Explosion03.png")
GLOBAL Frame, Duration#, LastFrame#, Boom as Integer []
Frame = 0
Duration# = 0.05
For x = 0 to 15
    Boom.Insert(LoadSubImage(Texture, "img_"+STR(x)))
Next x
 
Plane = CreateObjectPlane( 10.0, 10.0 )
    SetObjectImage( Plane, Boom[Frame], 0 )
    SetObjectTransparency( Plane, 1 )
 
SetCameraRotation( 1, 0.0, 0.0, 0.0 )
SetCameraPosition( 1, 0.0, 0.0, -15.0 )
 
Do
    If LastFrame# + Duration# <= Timer()
        INC Frame   :   If Frame > Boom.Length then Frame = 0
        SetObjectImage( Plane, Boom[Frame], 0 )
        LastFrame# = Timer()
    EndIf
    Sync()
loop
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.