hello guys, i have a doubt about arrays. I am making a system of skills for a wizard, he will exchange for skills using buttons on the keyboard and thus switching between his powers, and I am using an array to load each power (code below for better understanding):
well, does this system you use work? yes, and well what i wanted but i would even more like it to be through the array, walking through its information and not using any variable and a swtch case.
Here I come to ask for help, is there any way I can walk around the array and get information from it? if you can give me any tips or help me with some information I really appreciate it
GML:
//Create Event
//magic system
enum spells {
spell_fogo,
spell_bola_magica,
spell_esfera_eletrica
}
qual_spell_estou = 0;
blocos_spell = [spells.spell_fogo,spells.spell_bola_magica,spells.spell_esfera_eletrica];
//Step event
//choosing magic
if(keyboard_check_pressed(vk_up))
{
qual_spell_estou++;
}
else if(keyboard_check_pressed(vk_down))
{
qual_spell_estou--;
}
show_debug_message(qual_spell_estou);
switch(qual_spell_estou)
{
case 0:
if(mouse_check_button(mb_left))
{
instance_create_layer(obj_player_2.x,obj_player_2.y,"disparos",obj_bola_fogo);
}
break;
case 1:
if(mouse_check_button(mb_left))
{
var bola = instance_create_layer(obj_player_2.x,obj_player_2.y,"disparos",obj_bola_fogo);
bola.image_blend = c_green;
}
break;
}
Here I come to ask for help, is there any way I can walk around the array and get information from it? if you can give me any tips or help me with some information I really appreciate it