lenX = lengthdir_x(8, direction); lenY = lengthdir_y(8, direction); x1 = x + lenX; x2 = x - lenX; y1 = y + lenY; y2 = y - lenY; if collision_line(x1, y1, x2, y2, obSpacestation, true, false) { instance_destroy(); } if collision_line(x1, y1, x2, y2, obEnemy, true, false) { instance_nearest(x, y, obEnemy).shipHealth -= damage; instance_destroy(); } if collision_line(x1, y1, x2, y2, obSpaceship, true, false) { if obSpaceship.shipShield >= damage { obSpaceship.shipShield -= damage; obSpaceship.alarm[5] = obSpaceship.shield.shieldDelay * room_speed; } else if obSpaceship.shipShield < damage and obSpaceship.shield > 0 { damage -= obSpaceship.shipShield; obSpaceship.shipShield = 0; obSpaceship.alarm[5] = obSpaceship.shield.shieldDelay * room_speed; obSpaceship.shipHealth -= damage; } else { obSpaceship.shipHealth -= damage; } instance_destroy(); }