| 1 |
var y_goal = storm_y_start; |
| 2 |
var x_goal = storm_x_start; |
| 3 |
storm_alpha = 0.4; |
| 4 |
if (storm_x_pos < 320) |
| 5 |
storm_x_pos += storm_strength; |
| 6 |
else |
| 7 |
storm_x_pos = 10; |
| 8 |
if (obj_pl.x < x_goal) |
| 9 |
storm_delay_current = storm_delay; |
| 10 |
if (storm_delay_current > 0 && !storm_active) |
| 11 |
{ |
| 12 |
storm_delay_current -= 1; |
| 13 |
} |
| 14 |
else |
| 15 |
{ |
| 16 |
storm_active = true; |
| 17 |
storm_delay_current = storm_delay; |
| 18 |
} |
| 19 |
if (storm_active == true) |
| 20 |
{ |
| 21 |
var in_safezone; |
| 22 |
with (obj_pl) |
| 23 |
{ |
| 24 |
if (place_meeting(x, y, obj_sandstorm_safezone) && other.sandstorm_hit == false) |
| 25 |
{ |
| 26 |
in_safezone = true; |
| 27 |
} |
| 28 |
else if (place_meeting(x, y, obj_no_sandstorm_zone)) |
| 29 |
{ |
| 30 |
other.storm_alpha = 0; |
| 31 |
in_safezone = true; |
| 32 |
} |
| 33 |
else |
| 34 |
{ |
| 35 |
in_safezone = false; |
| 36 |
other.storm_alpha = 1; |
| 37 |
if (instance_exists(obj_pause_menu)) |
| 38 |
instance_destroy(obj_pause_menu); |
| 39 |
if (instance_exists(obj_dialogue)) |
| 40 |
{ |
| 41 |
global.dialogue_open = false; |
| 42 |
instance_destroy(obj_dialogue); |
| 43 |
} |
| 44 |
if (other.storm_distance == 0) |
| 45 |
other.storm_distance = point_distance(x, y, x_goal, y_goal) / other.storm_strength; |
| 46 |
} |
| 47 |
} |
| 48 |
if (storm_alpha_current < storm_alpha) |
| 49 |
{ |
| 50 |
if (in_safezone == false) |
| 51 |
storm_alpha_current += 0.03; |
| 52 |
else |
| 53 |
storm_alpha_current += 0.06; |
| 54 |
exit; |
| 55 |
} |
| 56 |
if (!audio_is_playing(snd_sandstorm)) |
| 57 |
{ |
| 58 |
var sandstorm_sound = audio_play_sound(snd_sandstorm, 1, 1); |
| 59 |
var fadein_time = 1000; |
| 60 |
if (!in_safezone) |
| 61 |
fadein_time = 500; |
| 62 |
audio_sound_gain(sandstorm_sound, 0, 0); |
| 63 |
audio_sound_gain(sandstorm_sound, 1, fadein_time); |
| 64 |
audio_sound_set_track_position(sandstorm_sound, random_range(0, audio_sound_length(sandstorm_sound))); |
| 65 |
} |
| 66 |
if (!in_safezone) |
| 67 |
{ |
| 68 |
sandstorm_hit = true; |
| 69 |
scr_cutscene_start(); |
| 70 |
if (obj_pl.x > x_goal) |
| 71 |
{ |
| 72 |
if (storm_alpha_current >= 1 && !alarm[0]) |
| 73 |
alarm[0] = 45; |
| 74 |
} |
| 75 |
else |
| 76 |
{ |
| 77 |
obj_pl.image_alpha = 1; |
| 78 |
obj_pl.image_angle = 0; |
| 79 |
scr_cutscene_end(); |
| 80 |
storm_active = false; |
| 81 |
storm_duration_current = storm_duration; |
| 82 |
storm_delay_current = storm_delay; |
| 83 |
storm_distance = 0; |
| 84 |
sandstorm_hit = false; |
| 85 |
scr_audio_fade_outscr_audio_fade_outfunction scr_audio_fade_out(arg0, arg1)
{
var snd = arg0;
var fade_len = arg1;
if (!audio_is_playing(snd))
return false;
audio_sound_gain(snd, 0, fade_len);
if (instance_exists(obj_audio_fade_helper))
{
with (obj_audio_fade_helper)
{
if (audio_to_fade == snd)
return false;
}
}
with (instance_create(0, 0, obj_audio_fade_helper))
audio_to_fade = snd;
} (262, 1000); |
| 86 |
} |
| 87 |
} |
| 88 |
else if (storm_duration_current > 0) |
| 89 |
{ |
| 90 |
storm_duration_current -= 1; |
| 91 |
} |
| 92 |
else |
| 93 |
{ |
| 94 |
storm_active = false; |
| 95 |
storm_duration_current = storm_duration; |
| 96 |
scr_audio_fade_outscr_audio_fade_outfunction scr_audio_fade_out(arg0, arg1)
{
var snd = arg0;
var fade_len = arg1;
if (!audio_is_playing(snd))
return false;
audio_sound_gain(snd, 0, fade_len);
if (instance_exists(obj_audio_fade_helper))
{
with (obj_audio_fade_helper)
{
if (audio_to_fade == snd)
return false;
}
}
with (instance_create(0, 0, obj_audio_fade_helper))
audio_to_fade = snd;
} (262, 1000); |
| 97 |
} |
| 98 |
} |
| 99 |
else if (storm_alpha_current > 0) |
| 100 |
{ |
| 101 |
storm_alpha_current -= 0.03; |
| 102 |
} |