bbmod_sprite_add_async

function

bbmod_sprite_add_async(_file, _callback)

Description

Asynchronnously loads a sprite from a file.

Arguments

Name Type Description
_file String The path to the file to load the sprite from.
_callback Function The function to execute when the sprite is loaded or if an error occurs. It must take the error as the first argument and the sprite as the second argument. If no error occurs, then undefined is passed. If an error does occur, then sprite is undefined.

Example

bbmod_sprite_add_async("sprite.png", function (_error, _sprite) {
    if (_error != undefined)
    {
        // Handle error here...
        return;
    }
    // Use the loaded sprite here...
});

Note

You must call bbmod_async_image_loaded_update in an appropriate event for this function to work!

Do you find this page helpful?

Copyright © 2022, BlueBurn. Built on November 16, 2022 using GMDoc.