Easiest way to load during runtime an external file spritesheet or images to a sprite object?

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I have my ideas, but maybe someone knows a way better than I thought up. The concept is pretty simple. I want to make a folder in my game's root folder to put spritesheets or folders for a collection of sprites each into, and during runtime it loads these into a sprite object so as to implement a thing such as a custom character in my game for players.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use "Load image from URL" action. Your sprite object needs to have all animations and empty frames added in advance. Then you set first animation/frame in runtime, load image, wait for it to finish loading, change to the next frame, load image.. Repeat for all images.

    This may take some time if there are many frames. Another option is to create lots of instances for all frames, and load them all at once. Something like this:

    For each Character -> Character Load image from URL "char_"&loopindex&".png"

    .

    The above method works only with individual images. To load a spritesheet you'll need to "cut" it into pieces using Drawing Canvas. Load the spritesheet into a temporary sprite, place a small Drawing Canvas object on top of the first frame in the image, paste the sprite, save canvas image, load it into the character sprite. Move the canvas to the next frame and repeat.

    .

    There is an Animation Loader plugin for C2, maybe you can convert it for C3, or find a ported version:

    construct.net/en/forum/extending-construct-2/addons-29/behavior-animation-loader-84883

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