MaxLos
Member
So.. I'm working on a platformer/fighter and I have my attacks for my characters set up like this:
When the attack button is pressed, I have it check if my sprite_index is any of the array values with a bunch of or statements
But as I add more attacks, I see that doing that is becoming less of an option...really don't feel like adding more or's. So I was wondering what would be a better way of doing this? Thank you Inb4 really simple solution and I'm just dumb
Code:
//Create Event
basiccombo[1,0] = spr_attack_1; //Sprite
basiccombo[1,1] = 4; //Frame to chain into next attack
basiccombo[2,0] = spr_attack_2;
basiccombo[2,1] = 3;
basiccombo[3,0] = spr_attack_3;
basiccombo[3,1] = 4;
basiccombo[4,0] = spr_attack_4;
basiccombo[4,1] = 5;
etc...
Code:
if sprite_index = basiccombo[1,0] or sprite_index = basiccombo[2,0] or sprite_index = basiccombo[3,0] or sprite_index = basiccombo[4,0]
{
//Do Stuff
}