L
lluuze
Guest
Hello all, I've been experiencing some problems with the hitboxes and enemy parent. Once the player's character collides with the enemy, they become stuck but before I made changes to the player's sprite; everything was fine and working. I recently switched back to the original sprite to fix these issues but can't figure out how to get the hitboxes for the enemy sprites working again.
I made a parent for the enemy sprite called "o_enemy"
This is the code I used inside this object.
/ Create -
initialize_movement_entity(1, .5, object1);
Initialize_hurtbox_entitys();
image_speed = 0;
max_health_ = 2;
health_ = max_health_;
starting_state_ = noone;
state_ = starting_state_;
enum enemy {
hit
}
/ o_hitbox -
if health_ <= 0 exit;
health_ -= other.damage_;
state_ = enemy.hit;
var _knockback_direction = point_direction(other.x, other.y, x, y);
set_movement(_knockback_direction, other.knockback_);
User Event 0 (Hit State)
/// @description Hit State
move_movement_entity(true);
apply_friction_to_movement_entity();
if speed_ == 0 {
state_ = starting_state_;
}
Step Event -
depth = -y;
if health_ <= 0 && state_ != enemy.hit {
instance_destroy();
}
if state_ != noone {
event_user(state_);
}
I also created an alarm for invincibility and enemy flashing once hit which seems to work.
Within the o_hitbox there is an alarm for instance_destroy(); along with:
// Create :
damage_ = 1;
knockback_ = 1;
targets_ = [];
I'd really appreciate the help, this is my first time creating a game from scratch which is a part of my college course. I've been following the Udemy tutorials from HeartBeast.
Thank you.
I made a parent for the enemy sprite called "o_enemy"
This is the code I used inside this object.
/ Create -
initialize_movement_entity(1, .5, object1);
Initialize_hurtbox_entitys();
image_speed = 0;
max_health_ = 2;
health_ = max_health_;
starting_state_ = noone;
state_ = starting_state_;
enum enemy {
hit
}
/ o_hitbox -
if health_ <= 0 exit;
health_ -= other.damage_;
state_ = enemy.hit;
var _knockback_direction = point_direction(other.x, other.y, x, y);
set_movement(_knockback_direction, other.knockback_);
User Event 0 (Hit State)
/// @description Hit State
move_movement_entity(true);
apply_friction_to_movement_entity();
if speed_ == 0 {
state_ = starting_state_;
}
Step Event -
depth = -y;
if health_ <= 0 && state_ != enemy.hit {
instance_destroy();
}
if state_ != noone {
event_user(state_);
}
I also created an alarm for invincibility and enemy flashing once hit which seems to work.
Within the o_hitbox there is an alarm for instance_destroy(); along with:
// Create :
damage_ = 1;
knockback_ = 1;
targets_ = [];
I'd really appreciate the help, this is my first time creating a game from scratch which is a part of my college course. I've been following the Udemy tutorials from HeartBeast.
Thank you.