if(instance_exists(objBoss))
{
OffX = 9+(15*(Shield == consShieldInstashield)) ;
OffY = 19+(5*(Shield == consShieldInstashield)) ;
_ObjectHandle = collision_rectangle(x-OffX, y-OffY, x+OffX, y+OffY, objBoss, true, true);
if(_ObjectHandle != noone){
if _ObjectHandle.bossHp == 0
exit;
// -----------------------------------------------------
// If the Player hits the boss:
// Handle Boss Values
// -----------------------------------------------------
if(Action == ActionRolling || Action == ActionJumping || Action == ActionSpindash || Action == ActionGlide || ShieldAction || Invincibility == 2 || SuperForm){
if _ObjectHandle.bossInv == false{
if _ObjectHandle.bossInv == false
audio_play_sound(sndBossHit, 1, false);
if _ObjectHandle.bossHp > 1
{
_ObjectHandle.bossHp -= 1;
_ObjectHandle.alarm[0] = room_speed/2;
_ObjectHandle.sprite_index = _ObjectHandle.hurtSprite;
}
else if _ObjectHandle.bossHp == 1
{
_ObjectHandle.sprite_index = _ObjectHandle.hurtSprite;
_ObjectHandle.bossDefeated = true;
_ObjectHandle.alarm[1] = room_speed/2;
_ObjectHandle.alarm[2] = room_speed*4;
}
_ObjectHandle.bossInv = true;
}
// -----------------------------------------------------
// Bounce Off Boss
// -----------------------------------------------------
X = x-_ObjectHandle.x;
Y = y-_ObjectHandle.y;
Magnitude = sqrt(X*X+Y*Y);
X /= Magnitude;
Y /= Magnitude;
if(sign(X) == sign(Speed) && sign(Y) == sign(Gravity)){
exit;
}
Speed = X*3;
Gravity = Y*3;
JumpVariable = false;
if(ShieldAction == true)
ShieldAction = false;
if(Action != ActionJumping && Action != ActionRolling)
Action = ActionNormal;
_ObjectHandle.Bounce += 2;
_ObjectHandle.Index = 3;
}
else
{
// -----------------------------------------------------
// If the Player does not hit the boss:
// Take Damage
// -----------------------------------------------------
scrPlayerHurt(_ObjectHandle, sndPlayerDead);
}
}
}