77 lines
No EOL
1.8 KiB
Text
77 lines
No EOL
1.8 KiB
Text
if !instance_exists(destination) and alarm[0] = -1
|
|
{
|
|
destAngle = direction;
|
|
}
|
|
else if instance_exists(destination)
|
|
{
|
|
|
|
speed = rocketSpeed;
|
|
image_angle = direction;
|
|
|
|
if direction != destAngle //ограниченный поворот
|
|
{
|
|
if angle_difference(destAngle, direction) < 0
|
|
{
|
|
direction -= rocketTurnRate/room_speed;
|
|
}
|
|
else
|
|
{
|
|
direction += rocketTurnRate/room_speed;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
direction = destAngle;
|
|
}
|
|
|
|
destAngle = point_direction(x, y, destination.x, destination.y);
|
|
|
|
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obSpacestation, true, false) and alarm[0] = -1
|
|
{
|
|
instance_destroy(destination);
|
|
instance_destroy();
|
|
}
|
|
|
|
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obEnemy, true, false) and alarm[0] = -1
|
|
{
|
|
instance_nearest(x, y, obEnemy).shipHealth -= damage;
|
|
instance_destroy();
|
|
}
|
|
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obSpaceship, true, false) and alarm[0] = -1
|
|
{
|
|
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();
|
|
}
|
|
|
|
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obRocket, true, true)
|
|
{
|
|
instance_destroy(destination);
|
|
instance_destroy(other);
|
|
instance_destroy();
|
|
}
|
|
|
|
lx = lengthdir_x(4, direction);
|
|
ly = lengthdir_y(4, direction);
|
|
}
|
|
if instance_exists(destination)
|
|
{
|
|
if destination.target = 0
|
|
{
|
|
rocketTurnRate++;
|
|
}
|
|
} |