-
Notifications
You must be signed in to change notification settings - Fork 7
/
bossfights.bgt
211 lines (210 loc) · 5.31 KB
/
bossfights.bgt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
sound bossstep;
int speed_modifier=0;
sound diebossfire;
movable_hazard[] boss_fireball(0);
class fireboss {
int health;
sound pain;
sound death;
sound field;
sound yell;
int fireball_interval;
timer spawnBetween;
int position;
fireboss() {
fireball_interval=11000;
field.load("sounds/boss2elec.wav");
position=80;
death.load("sounds/boss2die.wav");
health=60;
}
void taunt() {
yell.load("sounds/boss2taunt"+random(1,2)+".wav");
yell.stop();
yell.play();
}
void throw_fireball() {
if(spawnBetween.elapsed>=random(fireball_interval-1000,fireball_interval+1500)) {
taunt();
spawnBetween.restart();
int fLength=boss_fireball.length();
boss_fireball.resize(fLength+1);
boss_fireball[boss_fireball.length()-1].pos=fboss.position;
boss_fireball[boss_fireball.length()-1].strength=random(80,115);
boss_fireball[boss_fireball.length()-1].hitplayer.load("sounds/firehit.wav");
boss_fireball[boss_fireball.length()-1].voice.load("sounds/fireBall.wav");
boss_fireball[boss_fireball.length()-1].voice.pitch=random(80,110);
boss_fireball[boss_fireball.length()-1].speed=random(350,400)-speed_modifier;
positionBonus2();
boss_fireball[boss_fireball.length()-1].abovePlayer=true;
boss_fireball[boss_fireball.length()-1].voice.play_looped();
}
}
void die() {
death.play_wait();
boss_fireball.resize(0);
}
void retreat() {
position+=random(12,17);
positionBonus2();
}}
fireboss fboss;
void boss2fight() {
diebossfire.load("sounds/diebossfire.wav");
bossstep.load("sounds/step/lvl10/1.wav");
using=4;
level=10;
if(musictype!=8) music.load("sounds/boss2mus.ogg");
sounds.destroy_all();
sound bconv;
bconv.load("sounds/boss2conv.wav");
bconv.play();
while(bconv.playing) {
if(key_pressed(KEY_RETURN)) bconv.stop();
}
music.play_looped();
if(musictype!=8) music.volume=temp_volume;
fboss.field.play_looped();
doStuff();
}
void doStuff() {
bonuskeys();
}
void bonuskeys() {
while(true) {
if(key_down(KEY_LCONTROL)&&key_pressed(KEY_F9)) {
music.stop();
level++;initAfterLevels();}
if(level==11) {keys();break;}
if(key_pressed(KEY_H)) voice.speak_interrupt("health: "+playerhealth);
if(key_pressed(KEY_A)) voice.speak_interrupt("ammo: "+ammo);
if(playerhealth<=0) {
for(uint x=0; x<boss_fireball.length(); x++) {
boss_fireball[x].speed=random(350,400);
boss_fireball[x].pos=-50000;
boss_fireball[x].voice.volume=-25;
}
diebossfire.play_wait();
speed_modifier=0;
fboss.fireball_interval=10000;
playerposition=0;
playerhealth=250;
fboss.health=60;
fboss.position=80;
lives-=3;
boss_fireball.resize(0);
if(lives>0) boss2fight();
if(lives<=0) {
fboss.field.stop();
sound diecomp;
diecomp.load("sounds/health0conv.ogg");
diecomp.play();
while(diecomp.playing) {
if(diecomp.position>=45553) music.stop();
if(key_pressed(KEY_SPACE)||key_pressed(KEY_RETURN)) diecomp.stop();
}
menu();
}}
if(key_pressed(KEY_C)) alert("stack",get_call_stack());
if(key_pressed(KEY_NEXT)||key_pressed(KEY_NUMPAD3)) music.volume=music.volume-1;
if(key_pressed(KEY_PRIOR)||key_pressed(KEY_NUMPAD9)) music.volume=music.volume+1;
fboss.throw_fireball();
if(key_down(KEY_SPACE)) machgunshot();
if(key_pressed(KEY_LEFT)&&playerposition>=0) {bossstep.stop();
bossstep.play();
playerposition--;
}
if(key_pressed(KEY_RIGHT)) {bossstep.stop();
bossstep.play();
playerposition++;
bosscheck();
}
if(key_pressed(KEY_ESCAPE)) {
for(uint x=0; x<boss_fireball.length(); x++) {
boss_fireball[x].voice.stop();
}
fboss.field.stop();
menu();
return;
}
if(key_down(KEY_DOWN)) {ducked=true;
godown.stop();
godown.play();
while(true) {
if(key_pressed(KEY_H)) voice.speak_interrupt("health: "+playerhealth);
if(key_pressed(KEY_A)) voice.speak_interrupt("ammo: "+ammo);
fboss.throw_fireball();
for(uint x=0; x<boss_fireball.length(); x++) {
boss_fireball[x].moveControl(1);
}
if(!key_down(KEY_DOWN)) {goup.stop();
goup.play();
ducked=false;
break;
}
positionBonus2();
wait(5);
}}
positionBonus2();
for(uint x=0; x<boss_fireball.length(); x++) {
boss_fireball[x].moveControl(1);
}
wait(8);
}}
void positionBonus2() {
for(uint x=0; x<boss_fireball.length(); x++) {
position_sound_1d(boss_fireball[x].voice,playerposition,boss_fireball[x].pos, 4,3);
}
position_sound_1d(fboss.field,playerposition,fboss.position,4,2);
position_sound_1d(fboss.yell,playerposition,fboss.position,4,1);
}
void machgunshot() {
if(machineguntimer.elapsed>=125) {
machineguntimer.restart();
machinegun.stop();
machinegun.play();
ammo--;
if(fboss.position<=playerposition+gunrange&&fboss.position>playerposition-gunrange) {
speed_modifier+=30;
fboss.health=fboss.health-5;
fboss.pain.load("sounds/boss2hit"+random(1,2)+".wav");
position_sound_1d(fboss.pain,playerposition,fboss.position,4,1);
fboss.pain.play();
fboss.fireball_interval-=750;
fboss.retreat();
if(fboss.health<=0) {fboss.die();
voice.speak_interrupt_wait("The boss is dead! You have now gained 7000 points!");
totalpoints+=7000;
voice.speak_interrupt_wait("Your total score is:"+totalpoints);
boss_fireball.resize(0);
level=11;
playerposition=0;
levelendposition=285;
boulders=10;
levelenemies=55;
fireballs=9;
voice.speak_wait("level 11,");
levelDesc();
music.stop();
initAfterLevels();
return;
}
}
}}
void bosscheck() {
if(playerposition==fboss.position) {
sound scream;
fboss.field.volume=-13;
for(uint x=0; x<boss_fireball.length(); x++) {
boss_fireball[x].voice.volume=-30;
}
scream.load("sounds/boss2elecdie.wav");
scream.play_wait();
fboss.field.stop();
lives--;
fboss.fireball_interval=10000;
boss_fireball.resize(0);
playerposition=0;
speed_modifier=0;
boss2fight();
}}