T
Toothless
Guest
Very very new, so please be patient.
So Ive sketched out my game and built the basic menus.
I need a character selection screen that lets me select 1-5 different units, that goes in to a battlefield room.
I am tackling this first by creating a DS array. Ive followed a number of tutorials that use ds_create_map to define the values for multiple items. In my case, I am keeping it simple for now (to learn) and am defining the sprite and the name of the unit.
I created an object, and in its Create event I have three different units:
Is this the correct way to go about this? Because this information needs to be referenced constantly for unit stats in multiple rooms, do I need to place the object in the Start menu and make it persistent? Or do ds_maps 'exist' everywhere even if never added to a room?
Because I am adding an index to each entry, am I correct that to pull from the array anywhere else in the game, it would look like so:
The next question would build on this: Each unit will have different weapons in its array. So I would then need to add an array for each weapon, correct? (with its appropriate stats like damage, range, etc)
So Ive sketched out my game and built the basic menus.
I need a character selection screen that lets me select 1-5 different units, that goes in to a battlefield room.
I am tackling this first by creating a DS array. Ive followed a number of tutorials that use ds_create_map to define the values for multiple items. In my case, I am keeping it simple for now (to learn) and am defining the sprite and the name of the unit.
I created an object, and in its Create event I have three different units:
Code:
//Humanity Units
//PCM-600 Peacemaker
humanity[0] = ds_map_create();
ds_map_add(humanity[0], "sprite", sprPeacemaker);
ds_map_add(humanity[0], "name", "PCM-600 Peacemaker");
//ORS-200 Orson
humanity[1] = ds_map_create();
ds_map_add(humanity[1], "sprite", sprOrson);
ds_map_add(humanity[1], "name", "ORS-200 Orson");
//KZN-1000 Kuznets
humanity[2] = ds_map_create();
ds_map_add(humanity[2], "sprite", sprKuznets);
ds_map_add(humanity[2], "name", "KZN-1000 Kuznets");
Because I am adding an index to each entry, am I correct that to pull from the array anywhere else in the game, it would look like so:
Code:
name = ds_map_find_value(humanity[0], "name")