event_inherited();

spd = 2.5
hp = 3
spr_idle = spr_enemy_fast
spr_aggro = spr_enemy_fast_aggro
spr_hurt = spr_enemy_fast_hurt

state.add("hurt", {
	enter: function(){
		hp = approach(hp, 0, 1)
		sprite_index = spr_hurt
	},
	step: function(){
		if (animation_end()){
			state_switch(get_previous_state(id))
		}
		
		if (hp == 0){
			repeat (5) instance_create_layer(x, y, "Instances", obj_dust)
			instance_destroy()
		}
		
		move_and_collide()
		
		if (hsp != 0) image_xscale = sign(hsp)
	}
})
