S
Smenkare
Guest
I have equipment system written in ds_map. When i click in inventory some piece of armor i have code similar to this.
with(oPlayer)
{
oPlayer.sprite_index = ds_map_find_value(armory[0],"spriteIdle");
oPlayer.equiped = ds_map_find_value(armory[0],"attackSprite");
}
with(oDamage)
{
oDamage.damage = ds_map_find_value(armory[0],"damage");
}
It changes player object idle sprite and damage of damage object. First question is: is there a better way to do thing like this (changing variables). Maybe my idea of doing this is stupid, i dont know. My second question is:
if (key_attack && cooldown < 0)
{
sprite_index = equiped;
cooldown = 60;
}
It doesnt work. It seems that i cant use sprite as a variable. So how can i take data from ds_map to change sprite not of a player object but of some of his actions?
with(oPlayer)
{
oPlayer.sprite_index = ds_map_find_value(armory[0],"spriteIdle");
oPlayer.equiped = ds_map_find_value(armory[0],"attackSprite");
}
with(oDamage)
{
oDamage.damage = ds_map_find_value(armory[0],"damage");
}
It changes player object idle sprite and damage of damage object. First question is: is there a better way to do thing like this (changing variables). Maybe my idea of doing this is stupid, i dont know. My second question is:
if (key_attack && cooldown < 0)
{
sprite_index = equiped;
cooldown = 60;
}
It doesnt work. It seems that i cant use sprite as a variable. So how can i take data from ds_map to change sprite not of a player object but of some of his actions?