1 |
var spin_speed_max = 5; |
2 |
var spin_speed_inc = 0.15; |
3 |
var bullet_shoot_speed = 5; |
4 |
if (bullet_fade_delay > 0) |
5 |
{ |
6 |
bullet_fade_delay--; |
7 |
} |
8 |
else if (image_alpha < 1) |
9 |
{ |
10 |
image_alpha += 0.15; |
11 |
if (!alarm[0]) |
12 |
alarm[0] = bullet_spin_time; |
13 |
} |
14 |
switch (bullet_state) |
15 |
{ |
16 |
case 1: |
17 |
x = 320 + lengthdir_x(bullet_distance, bullet_dir_current); |
18 |
y = 320 + lengthdir_y(bullet_distance, bullet_dir_current); |
19 |
bullet_dir_current += bullet_spin_speed; |
20 |
if (bullet_spin_speed < spin_speed_max) |
21 |
bullet_spin_speed += spin_speed_inc; |
22 |
break; |
23 |
case 2: |
24 |
speed = bullet_shoot_speed; |
25 |
var battle_box = 3154; |
26 |
if (point_in_rectangle(x, y, battle_box.bbox_left + 15, battle_box.bbox_top + 15, battle_box.bbox_right - 15, battle_box.bbox_bottom - 15)) |
27 |
bullet_state = 3; |
28 |
break; |
29 |
case 3: |
30 |
var battle_box = 3154; |
31 |
var next_position_x = x + lengthdir_x(speed, direction); |
32 |
var next_position_y = y + lengthdir_y(speed, direction); |
33 |
var boundary_left = battle_box.bbox_left + 10; |
34 |
var boundary_top = battle_box.bbox_top + 10; |
35 |
var boundary_right = battle_box.bbox_right - 10; |
36 |
var boundary_bottom = battle_box.bbox_bottom - 10; |
37 |
if (!point_in_rectangle(next_position_x, next_position_y, boundary_left, boundary_top, boundary_right, boundary_bottom)) |
38 |
{ |
39 |
if ((next_position_x > boundary_right || next_position_x < boundary_left) && (next_position_y > boundary_bottom || next_position_y < boundary_top)) |
40 |
{ |
41 |
direction -= 180; |
42 |
} |
43 |
else if (next_position_x > boundary_right) |
44 |
{ |
45 |
if (direction > 180) |
46 |
direction -= 90; |
47 |
else |
48 |
direction += 90; |
49 |
} |
50 |
else if (next_position_x < boundary_left) |
51 |
{ |
52 |
if (direction > 180) |
53 |
direction += 90; |
54 |
else |
55 |
direction -= 90; |
56 |
} |
57 |
else if (next_position_y > boundary_bottom) |
58 |
{ |
59 |
if (direction > 270) |
60 |
direction += 90; |
61 |
else |
62 |
direction -= 90; |
63 |
} |
64 |
else if (next_position_y < boundary_top) |
65 |
{ |
66 |
if (direction > 90) |
67 |
direction += 90; |
68 |
else |
69 |
direction -= 90; |
70 |
} |
71 |
direction += irandom_range(-20, 20); |
72 |
x = xprevious; |
73 |
y = yprevious; |
74 |
audio_play_sound(snd_decibatbouncewave1, 1, 0); |
75 |
} |
76 |
break; |
77 |
} |
78 |
if (place_meeting(x, y, obj_heart_battle_fighting_parent) && obj_heart_battle_fighting_parent.vulnerable) |
79 |
{ |
80 |
if (!instance_exists(obj_battle_enemy_attack_ceroba_white_soul)) |
81 |
instance_create(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, obj_battle_enemy_attack_ceroba_white_soul); |
82 |
else |
83 |
obj_battle_enemy_attack_ceroba_white_soul.alarm[0] = 30; |
84 |
} |