Load Indivudal image into sprites problem

Get help using Construct 2

Post » Mon Nov 25, 2013 12:49 am

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.GameThirsty2013-11-25 00:53:56
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Nov 25, 2013 12:54 am

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.
B
45
S
15
G
73
Posts: 2,007
Reputation: 43,396

Post » Mon Nov 25, 2013 12:55 am

So I will have to create a different instance of Avatar for each loop run?
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Nov 25, 2013 12:57 am

I think what you might be able to do is set up animations for Avatar, and load individual animations(still images)
B
45
S
15
G
73
Posts: 2,007
Reputation: 43,396

Post » Mon Nov 25, 2013 1:01 am

The problem with that though, is what if I have 100 Avatar images? It would be a pain to manually create 100 animations
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Nov 25, 2013 1:01 am

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)
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Mon Nov 25, 2013 1:04 am

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.
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Nov 25, 2013 1:05 am

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.
B
45
S
15
G
73
Posts: 2,007
Reputation: 43,396

Post » Mon Nov 25, 2013 1:13 am

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


GameThirsty2013-11-25 01:15:32
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Nov 25, 2013 1:17 am

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.mindfaQ2013-11-25 01:27:25
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Next

Return to How do I....?

Who is online

Users browsing this forum: MoscowModder and 11 guests