3D Array of Variable Dimensions

Get help using Construct 2

Post » Wed Nov 20, 2013 2:19 am

Would you have any suggestions for finding, say, the length of a level within the dictionary? Depending on the length, each glyph will be updated individually by their UID and positioned sequentially, with each level of glyphs in a different place.

I also check the previous and next glyphs and change those accordingly, when one is clicked. Though I don't think it'd be too difficult based on what you've posted.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,836

Post » Wed Nov 20, 2013 2:27 am

Well , I'm with the others on using dictionnaries , I guess allocation 100x100x100 floats and not using them all would be a waste

@megatronx , If every index would take 1 millisecond to load , that would be 100 milliseconds , around ... 10000 seconds ? I'm probably totally off , but that's ok , because you get the point xD

Basically , you could add a string key to the dictionnary as "level|glyph1{0,1,1}|glyph2{0,1,1}|glyph3{0,1,1}" and compare the key with the level to load , then get the desired glyph using tokenat(src, index, separator)... basically , store all the info in one big string
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,481

Post » Thu Nov 21, 2013 7:11 pm

To avoid array-like dictionary keys, I'm current using a template like:
LevelXGlyphYVariableZ

Where X Y and Z are whatever values I need them to be. Honestly I'm not too keen on using the tokenat unless I have to.

Each time a new glyphs is created, which is one at a time, I store three new keys, which are basically variations of, for example, Level2Glyph0VariableX, Level2Glyph0VariableY, Level2Glyph0VariableZ.

To see if a glyph exists in the dictionary, I simply check if the key Level1Glyph5Variable0 exists.

However, counting glyphs will be a pain unless, so I think when I "destroy" a glyphs, I will count the UID as zero, and while counting or going through the "list" of glyphs, ignore anything with a UID of 0. :)

Again, thanks everyone for your input. I'm slowly getting my system converted to use a dictionary instead of an array.

I can't wait to put my game together. In two weeks time I will be showing my Game Design club what I've finished! :D C2 has taught me much about using arrays, dictionaries, angular interpolation, and keeping my code tidy. :)
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,836

Previous

Return to How do I....?

Who is online

Users browsing this forum: Julot135, Magistross and 22 guests