• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Created a sprite from URL, download succeeded but sprite is not drawn in HTML5

Hi all!

I'm using http_get_file to download an image from an url and then create a sprite using sprite_add in the async event that triggers once file request finishes. The request succeeds with status code "0" (ds_map_find_value(async_load, "status") = 0). However, for some reason, the image that I downloaded does not get drawn. This seems to work on Windows platform.

What am I missing here?

Create event:
GML:
newSprite = -4
filePath = "\images\\player"+string(0)+".png"
imgUrl = "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT2_ofdtFV7VBXo0ie1nNmcSoCIBeHAf4jz2w&usqp=CAU"
http_set_request_crossorigin("use-credentials")
imageRequest = http_get_file(imgUrl,filePath)
Async HTTP event:
GML:
if ds_map_find_value(async_load, "id") == imageRequest
{
    if ds_map_find_value(async_load, "status") >= 0
        newSprite = sprite_add(filePath,1,false,false,0,0)
}
Draw event:
GML:
if newSprite > -1
draw_sprite(newSprite,0,200,200)
 
Top