Loading sprite sheet from url for Construct 3

From the Asset Store
- This pack is suitable for shooting games, running games, platform games, and side-scrolling...
  • I'm looking for a way to load in a spirt sheet from a URL or single image per frame.

    I tried doing something like this.

  • No, you need to set animation frame to 0, load first image, wait for it to complete loading, then set animation frame to 1, load next image, wait etc..

    It may be a long process if you have many frames, so in this case it's easier and faster to put multiple instances of the sprite on the layout. Say, if you have 10 frames, put 10 sprites on the layout, set each of them to different frame, then load images into each sprite all at once, for example:

    For each sprite
    -> Sprite load image from url = "https://www.myserver.com/image_" & sprite.AnimationFrame & ".png"
    
  • Hi there,

    Thank you for your response and for your insights.

    I think we can both agree that loading sprite sheets this way is messy? I propose that we write a plugin that can load either a sprite sheet or PNG sequences from an external URL.

    Do you have any insights on creating C3 addons that implement the IAnimation and IAnimationFrame interface?

    I have written C2 plugins before, but seem to struggle a bit getting the C3 addons to work.

    Do you or anybody else know how to create a plugin for sprites that implements the IAnimation and IAnimationFrame interfaces so that we can create a solid sprite/png sequence loader from URL.

    An example URL could be : domain.com/Sheets/Animation.png.

    The plugin can either use a sprite sheet or a PNG sequence.

    The plugin can expose some functions that will state whether or not its loading a sprite sheet or a PNG sequence. Additionally, functions can be exposed to state the size of each frame if it is a sprite sheet or alternatively if it is a PNG sequence, a function can be exposed to state the number of images in the sequence. EG: domain.com/Sequence/1-10.png.

    The plugin will then create an animation based on the information it receives and download the image(s) and create animation frames at runtime.

    ** Note, i have seen some examples of c2 plugins that do this, however to translate or understand the new c3 interfaces is proving to be quite challenging.

    I think that this plugin/addon is a necessary addition to construct for basic games that need to be themed. The real reason to use spritesheets or png sequences is to add effects or animations around spinning wheels etc.

    Please can someone please assist me with understanding the basics of implementing these interfaces so that we can build a plugin that enables this functionality.

    Your insights are highly appreciated.

  • There is an addon for C2, it may be possible to convert it:

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi there,

    I have tried a few different methods.

    1) Tried to replace a spritesheet with a PNG sequence, this means that the different frames are individual files. This is network intensive, but does solve the immediate problem.

    2) I have tried to re-work the plugin from C2 with no luck.

    I can't believe that such a simple thing could be so difficult. C3/C2 does not give you any control over the animation object for the Sprite.

    Typical use cases for this:

    Today the game explodes using fire and smoke, tomorrow the explosion is hearts and rainbows etc.

    Why is there no support for loading an animation externally from the game.

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