this pretty piece of code
if instance_number(obj_sword_down)=0{
if instance_number (obj_sword_up)=0{
if instance_number (obj_sword_left)=0{
if instance_number (obj_sword_right)=0{
if (sprite_index = spt_protag_front_idle) {instance_create (x,y,obj_sword_down)}
if (sprite_index = spt_protag_moving_front) {instance_create (x,y,obj_sword_down)}
if (sprite_index = spt_protag_back_idle) {instance_create (x,y,obj_sword_up)}
if (sprite_index = spt_protag_moving_back) {instance_create (x,y,obj_sword_up)}
if (sprite_index = spt_protag_right_idle) {instance_create (x,y,obj_sword_right)}
if (sprite_index = spt_protag_moving_right) {instance_create (x,y,obj_sword_right)}
if (sprite_index = spt_protag_left_idle) {instance_create (x,y,obj_sword_left)}
if (sprite_index = spt_protag_moving_left) {instance_create (x,y,obj_sword_left)}
}
}
}
}
is what makes my sword swing dependent on which way my character is facing, and only if they aren't already swinging the sword.
if they're facing left, they swing left, and it's the same for every direction.
the swords are coded so that after they finish their swinging animation, they delete themselves.
No comments:
Post a Comment