Grab a glass of water and regret ever asking for help!
Lol
I will skip 3D Arrays.
Thank God you had some piety for the poor soul :)))
Thank you for the response! I guess a better question would be, how to fit the tilemap json data into the array and the downloaded file. The concept of arrays is really confusing to me, but as i understand it has 3 dimensions being used for the object name, x, and y position. It doesnt seem the tileset data would fit into the array, perhaps a different configuration or 2 files will be necessary to save a level? Im completely unfamiliar with the dictionary object and its capabilities.
The goal is to save each level as a separate file and load them all when starting the game. More elements will likely need to be saved as I continue development, so just trying to get an understanding of how to compile complexities into a save. Thank you for reading over this and my ramblings attempting to understand code :) updated the project link it should be accessible now!
Let me add to the combo, to give you the final blow :)
A lot of it is repeated, though I will try to make it more visual, maybe it will be easier to digest.
The first thing I will recommend to you is to spend some time learning (Dictionaries & Arrays). Take your time and learn how to (Add & Retrieve) data from those plugins. There are plenty of tutorials for that.
And have a look at the Manual:
https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/array?utm_campaign=C3Editor&utm_source=browser&utm_medium=r391&utm_term=PropertiesBar-LinkProperty
https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/dictionary?utm_campaign=C3Editor&utm_source=browser&utm_medium=r391&utm_term=PropertiesBar-LinkProperty
Dictionaries:
You can learn them in minutes as they are the easiest.
Use "Add Key": to add a -------> (key & Value)
Dictionary.get("KeyName"): to retrieve the Key -------> (Value)
Have a look at the Manual they will show you all the Expressions and Actions.
Arrays:
You can customize it to your needs, you can use (1D, 2D or 3D)
What is the difference between those 3 types?
It depends on the (Width, Height, Depth)
The depth is represented by "Z" --------> (Width, Height, Z)
Width = Total Columns
Height = Total Raws
How C3 works to retrieve the data?
X = Which Columns index Number is
Y = Which Raw index Number is
Z = Which dimension is
1D Array:
It is when you have a (Height = 1), meaning one Raw.
So here to retrieve any Column index data you just need the X index number
For example:
Here is an Array
Width = 7
Height = 1
The first coulmn will be --------> (X = 0)
The Last column will be --------> (X = 6)
If you want to retrieve the value from the first column ------> Array.at(0)
If you want to retrieve the value from the last column ------> Array.at(6)
2D Array:
It is when you have a (Height = 2) or greater, meaning multiple Raws.
So here to retrieve any data you will need the (X,Y) index numbers.
-The Top-Left Array cell will be at (0,0)
-The Top-Right Array cell will be at (6,0)
-The Bottom-Left Array cell will be at (0,2)
-The Bottom-Right Array cell will be at (6,2)
If you want to retrieve the value from the Top-Left------> Array.at(0,0)
If you want to retrieve the value from the Bottom-Right ------> Array.at(6,2)
3D Array:
Is when you add depth, meaning more than one dimension, (Z = 2) or greater
Each dimension is one Array independent, you can view it as layers:
(Dimension 1= Layer 1)
(Dimension 2 = Layer 2)
Etc...
As you can see in the picture:
Array 1--------> will be stored on Dimension1
Array 2--------> will be stored on Dimension2
Array 3--------> will be stored on Dimension3
To retrieve the data now you will need (X,Y,Z) for 3D Arrays.
If we take the example from the 2D Array Picture Avobe:
If we want to retrieve the data from:
-The Bottom-Right Array dimension1 will be at (6,2,1)
-The Bottom-Right Array dimension2 will be at (6,2,2)
-The Bottom-Right Array dimension3 will be at (6,2,3)
Finally:
How you save the data you will need to figure it out by yourself so you can select a structure that you will understand and feel comfortable with. There is no right or wrong, every one has his favourite way of doing it. You can use Dictionary only or just Arrays, or both. You can use multiple Arrays and dictionaries, the possibilities are endless.
If you do step one properly then you should be able to figure it out easily.
Here is just a quick random example, just for this tutorial:
You say you want to save the Tilemap XY and with, height
Use the expression ---------> Tilemap.AsJSON
-That will save you all the data of the tilemap
-Then for example you decide to use Dictionary to save all the enemies
-Then you decide to use Dictionary2 to save all the Objects like (Coins, Powerups, etc..)
Here is one possibility of how it can look like:
X = Level Numbers:
X = 0 ----> Level1
X = 1 ----> Level2
etc...
Then you have the whole (Height or column) to store all the data for the levels:
Example:
Level1:
Array.at(0,0) = Tilemap JSON
Array.at(0,1) = Dictionary Enemies
Array.at(0,2) = Dictionary Objects
Level2:
Array.at(1,0) = Tilemap JSON
Array.at(1,1) = Dictionary Enemies
Array.at(1,2) = Dictionary Objects
Level3:
Array.at(2,0) = Tilemap JSON
Array.at(2,1) = Dictionary Enemies
Array.at(2,2) = Dictionary Objects
And so on...