instance_create(global.playx, global.playy, obj_char_sword_hitbox)
if global.key_sword = true {
swinging = true
if global.direct = 0 {
sprite_index = spr_char_hitbox_down
alarm[4] = 6.6
}
if global.direct = 1 {
sprite_index = spr_char_hitbox_right
alarm[4] = 6.6
}
if global.direct = 2 {
sprite_index = spr_char_hitbox_up
alarm[4] = 6.6
}
if global.direct = 3 {
sprite_index = spr_char_hitbox_left
alarm[4] = 6.6
}
}
if swinging = false{
instance_destroy()
}
This is the code inside of the swords collision box. key_sword equates to pressing the attack button and swinging is the state of swinging the sword. Lemme know if more is needed