Little help with csv please

Get help using Construct 2

Post » Tue Dec 03, 2013 1:46 pm

This is probably a basic thing just my logic is broken but I cant figure it out. Sorry.
Im working on creating a catalog of my stuff.
I will have a list layout which I will generate from a database: for each item, a sprite with a thumbnail picture than item name ,like so:
thmbn 1, item1
thmbn 2, item 2
thmbn n, item n

I created a variable. When I input variable N(than click button) it creates line in the list layout:
thmbn N (sprite is loading from csv file At(thmbn variable).jpg.)
its all good.
Click button again creates new list item underneath. good.
problem:
When I change variable and click, it displays new list item with correct thmbn.jpg. but changes thmbn.jpg of all other items already displayed.

I tried using local variables but.. same result. How can I keep .jpg already displayed unchanged. Thank you!
P.S. love love love Construct2!
B
6
Posts: 10
Reputation: 295

Post » Tue Dec 03, 2013 1:58 pm

I guess you are using load from url, so probably you are loading all jpg's into the same sprite and the same frame of the sprite like in this topic:

load from url
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 03, 2013 6:31 pm

Hey, thanks a lot for the speedy response! I did load all the jpg's in separate frames like in your example, which is great. But I still have the same problem: all the displayed list items show the last thmbn.jpg I loaded (the last frame). I know what my problem is: it's the logic. All the create thmbn happen in the same event (on different button clicks) so the all the images reset to the last one.
I have to exclude the existing thumbnails from the loop. Or prevent the resetting by affecting only the current create of thmbn.
Can you point me into the right direction, please? Thanks in advance!
B
6
Posts: 10
Reputation: 295

Post » Tue Dec 03, 2013 6:48 pm

If you set the frame in a subevent of the creation event, only the created instance will be affected.

If this doesn't work you should read up on picking instances in the FAQ-thread on this forum.

I don't know how you have your events set up, so this is all I can do without seeing your capx.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 03, 2013 8:01 pm

[QUOTE=LittleStain] If you set the frame in a subevent of the creation event, only the created instance will be affected.

What is this magic? It worked! I don't really understand how, but it did. So easy. Obviously I have a lot to learn about subevents and C2. Thanks a million!
B
6
Posts: 10
Reputation: 295


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests