How do I remove images loaded from URL?

0 favourites
  • 5 posts
From the Asset Store
500 monsters and creatures images for card games - Set 1
  • I have a game which downloads images from a URL. As multiple sprites appear on screen at once, they can each download their own personal image. However, it will not do this for all players.

    This was achieved by having the sprite have 100 empty frames. When there are no sprites on screen or the frame hits 100, the frame number is reset to 0. What I've noticed is that when a player without a personal URL plays the game, if the frame has already been used, it will display the previously downloaded image, and there is no way to remove it.

    I have tried using the unload images action, as well as reloading the layout.

    How do I clear the frames loaded with a URL?

  • Overwrite it with another load sprite from url action. Can be an updated sprite, or a blank one.

  • Overwrite it with another load sprite from url action. Can be an updated sprite, or a blank one.

    Sorry, but was that a guess? It didn't work at all...

    The way I have it already set up, it will reach to my server and try to download an image based on the player's name. There's no way to determine whether or not there's the correct image there.

    Once you've downloaded an image to a sprite, failing to load another image to it doesn't solve the problem. I can only imagine this is a bug with Construct, seeing as unload appears to overlook downloaded images via URL.

  • The system unload action are for memory management and clearing textures that are not currently in use from vram. As started in the manual, this can only be done of there are no instances of the object remaining on the screen and on the tick after the last instance had been destroyed.

    If the object is recreated after being destroyed and unloaded, it will load up the whatever object textures it had before from memory (not vram), including animation frames that were loaded from url before.

    The way to clear the frames, as I mentioned before, is to use the load image from url again, loading an empty image, to overwrite and replace whatever you had previously loaded.

    What is a guess is what you have already set up, which is unclear to me, so sorry if I misunderstood your question, which I understood to be "How do I clear the frames loaded with a URL?"

    Here's an example dropbox.com/s/j2nm4ocxe0w1163/memorymanagementexample.c3p

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The system unload action are for memory management and clearing textures that are not currently in use from vram. As started in the manual, this can only be done of there are no instances of the object remaining on the screen and on the tick after the last instance had been destroyed.

    If the object is recreated after being destroyed and unloaded, it will load up the whatever object textures it had before from memory (not vram), including animation frames that were loaded from url before.

    The way to clear the frames, as I mentioned before, is to use the load image from url again, loading an empty image, to overwrite and replace whatever you had previously loaded.

    What is a guess is what you have already set up, which is unclear to me, so sorry if I misunderstood your question, which I understood to be "How do I clear the frames loaded with a URL?"

    Here's an example dropbox.com/s/j2nm4ocxe0w1163/memorymanagementexample.c3p

    Thanks for that, but it doesn't help my situation. What you have there is it loading one image if you press one button, and it loading another image if you press another button. It doesn't matter that the button is labelled "clear", it's still loading another sprite.

    In my game, if someone called Bob plays, it will download bob.png from my server. If someone called Mary plays, it will try to download mary.png from the server. However, there is no mary.png, so I want it to instead load the default object sprite. For some reason, Construct doesn't allow this... So if bob.png has already been assigned to frame 0, anyone who plays afterwards on frame 0 will load up bob.png.

    When you said "a blank one" I thought you meant a blank URL, not a blank sprite image. However, if I load a blank sprite, it will be blank, and will not revert back to the animation already loaded to the sprite.

    For now, I can get around this by having the default sprite in my files list, and having construct load that BEFORE trying to download it from the server.

    This feels like an unnecessary step, and so I will put this forward as a feature request.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)