T
Tanner021
Guest
Hey all,
I am having trouble figuring out how I will be able to switch between my sprite_index. I have been trying to make it so that when you attack the first time(button_c) you will throw a right punch... when you attack a second time the sprite_index will be the left punch. I would like it to be back and forth like that, but it's only been sticking to one sprite every time I perform the action. It seems obvious to me that I am countering the rotation by the code supplied in the keyboard_check_released spot. If you know any other way I can code it please to tell me.
create event
punchingrotation = 0;
stepevent
mainattack = keyboard_check_pressed(ord("C"))
if mainattack
{
if punchingrotation == 0
{
sprite_index = s_rightpunch
}
if punchingrotation == 1
{
sprite_index = s_leftpunch
}
}
if keyboard_check_released(ord("C"))
{
if punchingrotation == 0
{
punchingrotation = 1
}
if punchingrotation == 1
{
punchingrotation = 0
}
}
I am having trouble figuring out how I will be able to switch between my sprite_index. I have been trying to make it so that when you attack the first time(button_c) you will throw a right punch... when you attack a second time the sprite_index will be the left punch. I would like it to be back and forth like that, but it's only been sticking to one sprite every time I perform the action. It seems obvious to me that I am countering the rotation by the code supplied in the keyboard_check_released spot. If you know any other way I can code it please to tell me.
create event
punchingrotation = 0;
stepevent
mainattack = keyboard_check_pressed(ord("C"))
if mainattack
{
if punchingrotation == 0
{
sprite_index = s_rightpunch
}
if punchingrotation == 1
{
sprite_index = s_leftpunch
}
}
if keyboard_check_released(ord("C"))
{
if punchingrotation == 0
{
punchingrotation = 1
}
if punchingrotation == 1
{
punchingrotation = 0
}
}