VERY SERIOUS BUG! Sprite Created in Real Time For Loop Prob

0 favourites
  • 7 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • Problem Description

    If a Series of Image Sprites are Created in real time and then INSIDE the for loop calling each image sprite to load a different image, they will ALL load the same image.

    Attach a Capx

    http://expirebox.com/download/68be82f69 ... e1211.html

    Description of Capx

    CapX file plus the exported version, this will only work if running on server because of "Load Image from URL"

    Steps to Reproduce Bug

    • Just run the program and see the code, the image boxes should load alternate different images, but they ended up all loading the SAME images.

    Observed Result

    Just run the program and see the code, the image boxes should load alternate different images, but they ended up all loading the SAME images.

    Expected Result

    They should all be loading different images.

    This ONLY happens if the Sprite Object is created in a for Loop, it doesn't happen if the sprites are created in the Editor.

    This is terrible, please fix this.

    Affected Browsers

    • FireFox: (YES/NO)

    Operating System and Service Pack

    Windows 7

    Construct 2 Version ID

    The Latest Version

  • This is by design. Instances of the same type all share the same animation images so if you load an image for one it changes that shared animation frame for all of them. The reason for this is memory efficiency.

    Now if you want each instance to be able to have a different image you can use a different plugin besides Sprite. There are third party versions of the Sprite plugin that does that. I think it was called uniqueSprite or something.

  • You COULD also use the loop index and load each different image into a separate frame or animation, then set that specific sprite instance to that specific frame or animation. This should resolve your issue nicely without the need for third party plug-ins.

  • Dear R0J0hound, you are quite the expert here and I respect your opinion a lot.

    What you see in the sample only instantiate the sprite, but I assure you if the instantiate component is a TextBox, the text boxes can all have unique text across all of them, I know this because I am actually doing it for a massive game for a school that loads thousands of student data and when the text box are real time generated and fill with unique data, you don't see them all having the same data but instead retain the unique text given to the TextBoxes upon its creation in the for loop.

    The idea that it works like this across the board but the sprite doesn't behave like this really is a sign of a bug.

    and a pretty serious one I might add.

    In actual practice I am real time generating all the sprites calling them to load different student profile images.

    The textboxes generated in realtime are filled with their data and the TextBox behaves perfectly.

  • Dear Brashmonkey, not that this should be the way, but assuming your method work, This will have to do.

    Now...How DO you URL Load images into a separate frame or animation as you have said ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dear Brashmonkey, not that this should be the way, but assuming your method work, This will have to do.

    Now...How DO you URL Load images into a separate frame or animation as you have said ?

    I think he means adding more empty frames to your sprite object, then before you set "load image from URL" you first set the frame you want. You should also make the animation speed 0 beforehand.

    So it would look like this

    From 1 to 10

    -Set sprite animation frame to loopindex

    -load image from url

  • Closing as by design, exactly as R0J0hound described.

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