Dynamic loading of sprites

  • Hello,

    similar topics had been discussed already but the answers were not clear according to dynamic loading of sprite stripes.

    I just want to know if I understood right. As far as i understood the data of the images of the whole project will be transfered from the webserver to the browser, when i call the index.html of the game. It is not possible to transfer image data (i would need sprite stripes) from the webserve to the browser only when the affected layer is started. Is that right?

    The already discussed "layout by layout loading" is only about transfering data from already downloaded data into the browsers memory. Is that right?

    This question ist just for clarification so i have to accept this matter for my game. <img src="smileys/smiley19.gif" border="0" align="middle" />

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, you're correct in your understanding.

    You've got one other option, and that's to do it manually using the Sprite -> Load image from URL action. The idea here is that you use dummy or low-res images as the sprite images, and then, as necessary, load their high-res versions (probably pre-load it in the preceding layout). These high-res versions can be stored in the project folder and retrieved with a relative URL.

    Here's an example of it in action, and here's the capx. It's set to change at 1 second just to make it noticeable on high-speed connections. It'll sit in the browser's cache once it's downloaded.

    The only real caveat is that you don't have much control over this system, other than creating a very laborious, or very smart, chain of On image URL loaded conditions to ensure the player can't continue until everything is loaded.

  • Thanks for clearing this up.

    This was really helpful.

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