Load Indivudal image into sprites problem

0 favourites
  • 15 posts
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • Hello, im ready to punch a baby- I have been working to get this resolved for 5 hours now, and I haven't been able to find a solution.

    What I have is an array, I create sprites called "Avatar" and what im trying to do is load an individual image for each sprite.

    On run-time it creates all avatar sprites, but when I go to load an image it loads the last Avatar name in the array.

    An easier way to say, is how can I load an individual image for each individual avatar sprite. In my loop, it makes all avatar sprites load with the same image.

    Here is the screenshot of my event sheet:

    Thank you for the help.

  • As far as I know, all instances of a sprite must have the same image. If you edit the image for one instance, it will change it for all.

  • So I will have to create a different instance of Avatar for each loop run?

  • I think what you might be able to do is set up animations for Avatar, and load individual animations(still images)

  • The problem with that though, is what if I have 100 Avatar images? It would be a pain to manually create 100 animations

  • As plinkie said, if you load a sprite image from URL, it will be loaded into the current frame of the object and all instances of the object that use the same frame will share this picture.

    So: use different frames for each picture. (create blank ones in the image editor, then change to a new frame after you created the avatar object depending on your loopindex)

  • The problem with that is, the array changes dynamically. I am basically making a friends list inside Construct 2. So lets say I have 100 friends on my list, which is stored in a database, and I only created 50 frames in Avatar, then it would break that system.

    AvatarName and Avatar are dynamic.

  • From my experience the Avatar sprite will always use the same image unless you change to another anim. If Avatar is a Family it may act differently but I haven't messed around too much with Families. Perhaps someone can prove me wrong but I don't think you can have multiple instances of Avatar with different default images.

  • I have this and it shows different images, but they all change to the same image. I have highlighted my change in red. I have set the frames too

  • probably animation speed not set to 0

    "The problem with that is, the array changes dynamically. I am basically making a friends list inside Construct 2. So lets say I have 100 friends on my list, which is stored in a database, and I only created 50 frames in Avatar, then it would break that system."

    I would only load the images on usage. You can store the images as data URI (string) in an array (I guess) and then just load it when you display it. This way you only will need as many frames as the number of avatars you display simultaneously.

  • I fixed it, setting animation to stop.

    However, this method does not put into account of how many friends a user will have in my app. That is a dynamic variable right? I wont know how many frames to create, example would be, if a user has 200 friends, and I only created 100 frames, it would break the system we have here.

    Edit: Unless I limit how many friends a user can have. But I wouldn't prefer that

  • Import 9999 frames : D

    EDIT: I don't think you can import more than 3000 frames. My C2 crashes. So I guess that's your max friend count : P

  • Looks like if you have more then 3000 friends you have no life, and you'd have to create a separate account. :p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Or you're famous!

  • I guess the amount of friends over 3,000 isn't an oddity, I see people with Facebook friends over 3,000 hahaha

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