I don't get how the sprites are created

Discussion and feedback on Construct 2

Post » Tue Nov 29, 2016 3:56 pm

uid 0 is the first layout you create, which is the first "canvas editor screen" we create when we open a new template


so if you add 500 objects in the project sidebar their uid will be counting from uid0+order of object created 1 2 3 etc

but... while you stop creating objects 123
and then create layout number 2

uid of objects that will be added skip another 1

since the new layout will have uid of last object placed objectuid3+1 which means the layout2 is uid4 which then objects continues with uid 4+1,+2+3 etc...not sure if im making myself understood. or if is the answer your looking for

however what you are experiencing is more of a memory remain of capture of a first state, but again im not sure what wold you expect from it to do... it seems to be working fine as you explained in the pictures... there is nothing out of the ordinary unless your used with some other coding language that maybe was doing it different or had a different logic programming?
Last edited by gamecorpstudio on Tue Nov 29, 2016 3:59 pm, edited 1 time in total.
B
78
S
23
G
69
Posts: 1,353
Reputation: 43,985

Post » Tue Nov 29, 2016 3:58 pm

I'm asking a simple thing: What defines, in the files, the veryy first instance of a sprite you placed. If you say its UID, then it's bugged
B
33
S
12
G
3
Posts: 231
Reputation: 4,436

Post » Tue Nov 29, 2016 4:08 pm

Psychokiller1888 wrote:I'm asking a simple thing: What defines, in the files, the very first instance of a sprite you placed. If you say its UID, then it's bugged


now you asked the proper question and i see your problem: see manual here ---> Common Features IID vs UID

also simple explanation if you dont want to read the manual but i strongly recommend it so you understand better, but anyway this is my version of how i understand it:
Each sprite type is defined by IID(index id), while UID (Unique id) is more of a counting order which its why it makes it weird for you since i guess when you spawn a new sprite, you also spawn a sprite of a different type or have a uid that is incorrect for that type of object...

so by using IID instead of UID to get the right same type object expressions . that will get you the index number of the same type object.


to ask your question simple : IID defines object types in C2 UID counts the total numbers no matter of type.
B
78
S
23
G
69
Posts: 1,353
Reputation: 43,985

Post » Tue Nov 29, 2016 4:10 pm

IID is a runtime generated IndexID that is not referenced in the xml files, while UID is a UniqueIDentifier used and referenced in the save xml files

IID indexes the object according to its runtime creation timestamp, by type, and UID ensures a possibility to reference the object by being sure to never return more than one result. IID is not unique and volatile where UID is unique and by definition should never change (which is not the case in C2, strange, but well, definitions....)

I'm still asking what defines, for C2, the first placed instance of a sprite
B
33
S
12
G
3
Posts: 231
Reputation: 4,436

Post » Tue Nov 29, 2016 4:27 pm

Psychokiller1888 wrote:I'm still asking what defines, for C2, the first placed instance of a sprite


I'm pretty sure it's defined by the first layout it appears in. So layout order is important. It's quite common to have a layout where you place all your default instances.
B
23
S
6
G
10
Posts: 1,041
Reputation: 7,553

Post » Tue Nov 29, 2016 4:30 pm

I do have a placeholder layout, containing the InterfaceElements sprite with UID 1 that is set to defaults

What defines the layouts order then? Cause technically, that layout is never displayed/used and the start layout is my "MainMenu" layout
B
33
S
12
G
3
Posts: 231
Reputation: 4,436

Post » Tue Nov 29, 2016 4:35 pm

Psychokiller1888 wrote:I do have a placeholder layout, containing the InterfaceElements sprite with UID 1 that is set to defaults

What defines the layouts order then? Cause technically, that layout is never displayed/used and the start layout is my "MainMenu" layout


Yep, you never actually do anything else with your layout holding the default instances. Just place it first in the project bar. Which is where you can see and change the layout order.
B
23
S
6
G
10
Posts: 1,041
Reputation: 7,553

Post » Tue Nov 29, 2016 4:41 pm

You tha masta!

Well, all together, to fix this mess I did:

Manually, in the xml project file, made sure that my problematic sprite has UID 1 (by swapping its UID with the one that had the UID 1)
Opened C2
Created a new subfolder in my "layouts" folder, named it AAA (you can't place layouts before subfolders)
Place my placeholder layout into that AAA subfolders. That placed it on top of the list

Well, let's not sing victory quite yet, I was already sure to have fixed this a couple of times, but it always fell down at some point
B
33
S
12
G
3
Posts: 231
Reputation: 4,436

Post » Tue Nov 29, 2016 9:36 pm

Psychokiller1888 wrote:No, I'm saying that even if the very first created sprite in my project has the default width set positively and is scaled 1:1, the code generated ones spawn reverted. The code generated ones even take the instance variable values from another sprite placed somewhere else, dunno which, but not the very first one. So it's not taking the very first created sprite, but some random others


Do you maybe create from a family ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Nov 30, 2016 8:15 am

Thanks for the answer. I posted just above yours, the solution. It is wrong to guide people telling them C2 makes a copy of the very first instance placed in C2 as we can see here. It copies the first instance it loads, so nothing to do with the UID of that element. It is taking the first instance placed from the first layout it loads.
B
33
S
12
G
3
Posts: 231
Reputation: 4,436

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: technofou and 16 guests