This repository has been archived by the owner on Feb 11, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
skyway.prg
362 lines (266 loc) · 6.28 KB
/
skyway.prg
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
//
// Skyway, a vertical space shooter prototype.
// Copyright 2005 Alex Margarit, licensed under GNU GPL3.
//
program skyway;
const
frames = 30;
enemyshipspeed = 2;
bulletspeed = 4;
bulletdelay = 3;
bonusspeed = 2;
maxships = 5;
maxbullets = 3;
maxenemybullets = 6;
enemybulletdamage = 1;
explosiondamage = 10;
startlife = 100;
global
ships = 0;
bullets = 0;
enemybullets = 0;
lastbullet = 0;
life = startlife;
score = 600;
hiscore;
shipspeed = 6;
playership;
int enemies[1];
begin
set_title("SkyWay by Alex!");
set_fps(frames,0);
full_screen = false;
set_mode(320,240,8);
load_fpg("skyway.fpg");
write(0,6,20,0,"This game is in its very early stages, so any");
write(0,6,34,0,"bug reports or suggestions are welcome!");
write(0,6,48,0,"Send them to artraid@gmail.com - Thank you!");
set_text_color(rgb(5,140,255));
write(0,6,6,0,"SkyWay by Alex!");
write(0,6,62,0,"Press START to continue.");
loop
if (key(_enter)) break; end
frame;
end
delete_text(0);
enemies[0] = 14;
enemies[1] = 15;
load("skyway.sco",hiscore);
set_text_color(rgb(215,215,215));
write(0,6,6,0,"FPS:");
write(0,282,6,0,"Life:");
write(0,6,228,0,"Score:");
write(0,230,228,0,"Hiscore:");
set_text_color(rgb(255,239,202));
write_int(0,6,16,0,&fps);
write_int(0,282,16,0,&life);
write_int(0,48,228,0,&score);
write_int(0,284,228,0,&hiscore);
frame;
playership = ship(160,200);
start_scroll(0,"skyway.fpg",12,0,0,2);
scroll[0].camera = land_camera();
start_scroll(1,"skyway.fpg",4,0,0,2);
scroll[1].camera = bar_camera();
while(life > 0)
if(rand(1,10) < 5 and ships < maxships)
ships++;
enemyship(rand(10,310),0);
end
frame;
end
let_me_alone();
savescore();
end
//
// Cameras Process
//
process land_camera();
begin
x = 0;
loop
y -= shipspeed - 5;
frame;
end;
end;
process bar_camera();
begin
x = 0;
loop
y -= shipspeed - 2;
frame;
end;
end;
//
// Ship Process
//
process ship(x,y)
begin
graph = 2;
z = 1;
loop
if(key(_left) and x > 75) x -= shipspeed; end
if(key(_right) and x < 245) x += shipspeed; end
if(key(_up) and y > 15) y -= shipspeed; end
if(key(_down) and y < 225) y += shipspeed; end
if(key(_control) and lastbullet == 0 and bullets < maxbullets)
lastbullet += bulletdelay;
bullet(x,y);
end
if(lastbullet > 0) lastbullet--; end
if(key(_tab) and key(_backspace)) life = 0; end
frame;
end
end
//
// Bullet Process
//
process bullet(x,y)
private
die;
begin
graph = 3;
z = 3;
bullets++;
while(y > 0)
y -= bulletspeed;
frame;
end
bullets--;
return;
end
//
// Enemy Ship Process
//
process enemyship(x,y)
private
random;
picture;
xspeed;
begin
graph = enemies[rand(0,1)];
z = 2;
while(y < 240)
y += enemyshipspeed;
if((x + xspeed) < 310 and (x + xspeed) > 10) x += xspeed; end
random = rand(1,50);
if(random == 1 and enemybullets < maxenemybullets) enemybullet(x,y);
//elseif(random > 5 and random < 11 and x < playership.x) xspeed++;
//elseif(random > 10 and random < 16 and x > playership.x) xspeed--; end
elseif(x < playership.x) xspeed = enemyshipspeed;
elseif(x > playership.x) xspeed = -enemyshipspeed;
elseif(x == playership.x) xspeed = 0; end
if (collision(type bullet))
if (random == 16) medicinebonus(x,y);
elseif (random == 17) scorebonus(x,y);
elseif (random == 18 and shipspeed < 17) speedbonus(x,y); end
ships--;
score++;
return;
elseif (collision(type ship))
life -= explosiondamage;
ships--;
return;
end
frame;
end
ships--;
return;
end
//
// Enemy Bullet Process
//
process enemybullet(x,y)
begin
graph = 5;
z = 3;
enemybullets++;
while(y < 240)
y += bulletspeed;
if(collision(type ship))
life -= enemybulletdamage;
y = 240;
end
frame;
end
enemybullets--;
return;
end
//
// Medicine Bonus Process
//
process medicinebonus(x,y)
begin
graph = 6;
z = 3;
while(y < 240)
y += bonusspeed;
if(collision(type ship))
life += 20;
return;
end
frame;
end
return;
end
//
// Score Bonus Process
//
process scorebonus(x,y)
begin
graph = 9;
z = 3;
while(y < 240)
y += bonusspeed;
if(collision(type ship))
score += 20;
return;
end
frame;
end
return;
end
//
// Speed Bonus Process
//
process speedbonus(x,y)
begin
graph = 10;
z = 3;
while(y < 240)
y += bonusspeed;
if(collision(type ship))
shipspeed += 1;
return;
end
frame;
end
return;
end
//
// Hiscore Process
//
process savescore()
begin
delete_text(0);
set_text_color(rgb(0,0,0));
if (score > hiscore)
hiscore = score;
write(0,60,6,0,"You've got a hiscore!");
write(0,60,20,0,"Saving highscore on SMC card...");
frame;
save("skyway.sco",hiscore);
write(0,60,34,0,"DONE.");
write(0,60,48,0,"Press A to soft-reboot your unit.");
elseif (score == hiscore)
write(0,60,6,0,"Your score was equal to the hiscore! WOW!");
write(0,60,20,0,"Press A to soft-reboot your unit.");
elseif (score < hiscore)
write(0,60,6,0,"You did not get a hiscore.");
write(0,60,20,0,"Press A to soft-reboot your unit.");
end
loop
if (key(_control)) break; end
frame;
end
end