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 |
storm_delay_current -= 1 |
12 |
else |
13 |
{ |
14 |
storm_active = true |
15 |
storm_delay_current = storm_delay |
16 |
} |
17 |
if (storm_active == true) |
18 |
{ |
19 |
with (obj_pl) |
20 |
{ |
21 |
if (place_meeting(x, y, obj_sandstorm_safezone) && other.sandstorm_hit == false) |
22 |
var in_safezone = true |
23 |
else if place_meeting(x, y, obj_no_sandstorm_zone) |
24 |
{ |
25 |
other.storm_alpha = 0 |
26 |
in_safezone = true |
27 |
} |
28 |
else |
29 |
{ |
30 |
in_safezone = false |
31 |
other.storm_alpha = 1 |
32 |
if instance_exists(obj_pause_menu) |
33 |
instance_destroy(obj_pause_menu) |
34 |
if instance_exists(obj_dialogue) |
35 |
{ |
36 |
global.dialogue_open = false |
37 |
instance_destroy(obj_dialogue) |
38 |
} |
39 |
if (other.storm_distance == 0) |
40 |
other.storm_distance = (point_distance(x, y, x_goal, y_goal)) / other.storm_strength |
41 |
} |
42 |
} |
43 |
if (storm_alpha_current < storm_alpha) |
44 |
{ |
45 |
if (in_safezone == false) |
46 |
storm_alpha_current += 0.03 |
47 |
else |
48 |
storm_alpha_current += 0.06 |
49 |
return; |
50 |
} |
51 |
if (!audio_is_playing(snd_sandstorm)) |
52 |
{ |
53 |
var sandstorm_sound = audio_play_sound(snd_sandstorm, 1, 1) |
54 |
var fadein_time = 1000 |
55 |
if (!in_safezone) |
56 |
fadein_time = 500 |
57 |
audio_sound_gain(sandstorm_sound, 0, 0) |
58 |
audio_sound_gain(sandstorm_sound, 1, fadein_time) |
59 |
audio_sound_set_track_position(sandstorm_sound, random_range(0, audio_sound_length(sandstorm_sound))) |
60 |
} |
61 |
if (!in_safezone) |
62 |
{ |
63 |
sandstorm_hit = true |
64 |
scr_cutscene_startscr_cutscene_startfunction scr_cutscene_start() //gml_Script_scr_cutscene_start
{
global.cutscene = true
obj_pl.state = gml_Script_scr_frozen_state
obj_pl.image_index = 0
obj_pl.image_speed = 0
} () |
65 |
if (obj_pl.x > x_goal) |
66 |
{ |
67 |
if (storm_alpha_current >= 1 && (!alarm[0])) |
68 |
alarm[0] = 45alarm[0]obj_pl.x = storm_x_start
obj_pl.y = storm_y_start |
69 |
} |
70 |
else |
71 |
{ |
72 |
obj_pl.image_alpha = 1 |
73 |
obj_pl.image_angle = 0 |
74 |
scr_cutscene_end() |
75 |
storm_active = false |
76 |
storm_duration_current = storm_duration |
77 |
storm_delay_current = storm_delay |
78 |
storm_distance = 0 |
79 |
sandstorm_hit = false |
80 |
scr_audio_fade_outscr_audio_fade_outfunction scr_audio_fade_out(argument0, argument1) //gml_Script_scr_audio_fade_out
{
var snd = argument0
var fade_len = argument1
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
} (snd_sandstorm, 1000) |
81 |
} |
82 |
} |
83 |
else if (storm_duration_current > 0) |
84 |
storm_duration_current -= 1 |
85 |
else |
86 |
{ |
87 |
storm_active = false |
88 |
storm_duration_current = storm_duration |
89 |
scr_audio_fade_outscr_audio_fade_outfunction scr_audio_fade_out(argument0, argument1) //gml_Script_scr_audio_fade_out
{
var snd = argument0
var fade_len = argument1
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
} (snd_sandstorm, 1000) |
90 |
} |
91 |
} |
92 |
else if (storm_alpha_current > 0) |
93 |
storm_alpha_current -= 0.03 |