hey everyone
I tried creating hitboxes for my character but they don't seem to be workink, help would be appreciated
first I created an object called o_hitbox and added a collision to my enemy o_knight and then made the following code
Create event
creator = noone
knockback = 1
damage = 1
Alarm event
instance_destroy()
Then I created a script called create_hitbox with the following code
///@arg x
///@arg y
///@arg creator
///@arg sprite
///@arg knockback
///@arg lifespan
///@arg damage
///@arg xscale
var x_position = argument0
var y_position = argument1;
var creator = argument2;
var sprite = argument3
var knockback = argument4
var lifespan = argument5
var damage = argument6
var xscale = argument7
function create_hitbox(x_position, y_position, creator, sprite, knockback, lifespan, damage, xscale)
{
var hitbox = instance\_create\_layer(x\_position, y\_position, "instances", o\_hitbox)
hitbox.sprite\_index = sprite
hitbox.creator = creator
hitbox.knockback = knockback
hitbox.alarm\[0\] = lifespan
hitbox.damage = damage
hitbox.image\_xscale = xscale
}
Then I just added it to my object o_skeleton in the respective attack states (attack one, attack two, attack three) (because I have a combo workign)
if animation_hit_frame(0)
{
create\_hitbox(x, y, self, s\_skeleton\_attack\_one\_damage, 3, 3, 1, image\_xscale)
}
and the same for the rest of the attacks, trading the sprite for the respective sprite of the attack, example, s_skeleton_attack_two damage
Please help, it's driving me mad!!!
Btw my weapon is already part of my character, its not a pickup
And I already set the correct origin to the needed sprites