/***************************************************************
* Images *
***************************************************************/
var xx : array 1 .. 4 of int := init (0, 0, 0, 0) % plain array
var xxb : array 1 .. 1 of int := init (0)
var sprite : array 1 .. 4 of int % your ship
sprite (1) := Pic.FileNew ("redplane1.bmp")
sprite (2) := Pic.FileNew ("redplane2.bmp")
sprite (3) := Pic.FileNew ("redplane3.bmp")
sprite (4) := Pic.FileNew ("redplane4.bmp")
var sprite1 : array 1 .. 6 of int % life bar
sprite1 (1) := Pic.FileNew ("life1.bmp")
sprite1 (2) := Pic.FileNew ("life2.bmp")
sprite1 (3) := Pic.FileNew ("life3.bmp")
sprite1 (4) := Pic.FileNew ("life4.bmp")
sprite1 (5) := Pic.FileNew ("life5.bmp")
sprite1 (6) := Pic.FileNew ("life6.bmp")
var sprite2 : array 1 .. 2 of int % special ability bar
sprite2 (1) := Pic.FileNew ("mana1.bmp")
sprite2 (2) := Pic.FileNew ("mana2.bmp")
var sprite3 : array 1 .. 4 of int % enemy planes
sprite3 (1) := Pic.FileNew ("enemy1.bmp")
sprite3 (2) := Pic.FileNew ("enemy2.bmp")
sprite3 (3) := Pic.FileNew ("enemy3.bmp")
sprite3 (4) := Pic.FileNew ("enemy4.bmp")
var missle : int := Pic.FileNew ("upgrade2.bmp")
var background : int := Pic.FileNew ("back.bmp") % background
/***************************************************************
* Scoring System *
***************************************************************/
var e_plane : array 1 .. 5 of int % enemy plain score keep
var plane_count : int := 0 % plains destroyed
var z : int % data file
/***************************************************************
* Movement *
***************************************************************/
var chars : array char of boolean
var key : string (1) % for shotting missles
var byt, byb : int := 0 % bullet up y,bottom y,
var bxr, bxl : int := 0 % bullet right x,left x
var yt, yb : int := 0 % plane up y,bottom y,
var xr, xl : int := 0 % plane right x,left x
var exr, exl, eyt, eyb : int := 0
/***************************************************************
* Other *
***************************************************************/
var i : int % information data file
var counter : int := 10 % position of y
var counter2 : int := 0 % how many characters
var counter3 : int := 0 % x counter for information data
var charpool : array 1 .. 2000 of string % data file letters for introduction
var font : int := Font.New ("Times New Roman:10") % font for menu section
var planelife : int := 5 % plane life
var planespecial : int := 1 % plane special ability
var num : int := 4
var ebullet : int := 0
/***************************************************************
* Introduction *
***************************************************************/
procedure info
setscreen ("noecho,nocursor")
colorback (black)
cls
open : i, "info.t", get
assert i > 0
loop
get : i, skip
exit when eof (i)
counter2 += 1
get : i, charpool (counter2) : *
end loop
for a : 1 .. counter2
for x : 1 .. length (charpool (a))
locate (1 + counter3, counter)
colour (white)
put charpool (a) (x) ..
delay (40)
counter += 1
end for
counter := 10
counter3 += 1
end for
Input.Pause
cls
close : i
end info
/***************************************************************
* Game Code *
***************************************************************/
%/%%%%%%%%%%%%%%%
% Score Sytem %
%%%%%%%%%%%%%%%\%
open : z, "score system.t", get
assert z > 0
for x : 1 .. 5
get : z, skip
get : z, e_plane (x)
end for
close : z
procedure boundries (x, y : int)
%/%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set Boundries For Plane %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\%
for z : 1 .. 4
end for
if sprite (z) >= bxr - 1 then
sprite (z) := xl + 1
end if
end boundries
procedure bars
%/%%%%%%%%%%%%%%%%%%
% Life Counter %
%%%%%%%%%%%%%%%%%%\%
for z : 1 .. 1
Pic.Draw (sprite (xx (z)), bxr, byt, picMerge)
end for
if ebullet = sprite (z) - 25 then
planelife := planelife - 1
end if
%/%%%%%%%%%%%%%%%%%%%%
% Draw Life Bars %
%%%%%%%%%%%%%%%%%%%%\%
for x : 1 .. 6
if planelife = 5 then
Pic.Draw (sprite1 (1), 0, 225, picMerge)
elsif planelife = 4 then
Pic.Draw (sprite1 (2), 0, 225, picMerge)
elsif planelife = 3 then
Pic.Draw (sprite1 (3), 0, 225, picMerge)
elsif planelife = 2 then
Pic.Draw (sprite1 (4), 0, 225, picMerge)
elsif planelife = 1 then
Pic.Draw (sprite1 (5), 0, 225, picMerge)
else
Pic.Draw (sprite1 (6), 0, 225, picMerge)
end if
end for
View.Update
%/%%%%%%%%%%%%%%%%%%%
% Plain Special %
%%%%%%%%%%%%%%%%%%%\%
if chars ('x') then
planespecial := planespecial - 1
end if
for y : 1 .. 2
if planespecial = 1 then
Pic.Draw (sprite2 (1), 0, 125, picMerge)
else
Pic.Draw (sprite2 (2), 0, 125, picMerge)
end if
end for
end bars
process enemy
%/%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Randomize Enemy's and Location %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\%
loop
randint (byt, 0, maxx)
for decreasing x : maxy .. 1
exr += +exr + exl
eyt += +eyt + eyb
randomize
randint (num, 1, 4)
View.Update
Pic.Draw (sprite3 (num), eyt + x - x, exr + x, picMerge)
end for
end loop
end enemy
process shoot
%/%%%%%%%%%%%%%%%%%%
% Special Attack %
%%%%%%%%%%%%%%%%%%\%
if chars ('x') then
if xx (1) > 0 then
for bullet : 1 .. maxy - (byt)
for x : 1 .. 1
bxr += +xl + xr
byt += +yb + yt
View.Update
Pic.Draw (background, 0, 0, picCopy)
Pic.Draw (sprite (xx (x)), bxr, byt, picMerge)
View.Update
Pic.Draw (missle, bxr + 25, byt + bullet, picMerge)
View.Update
Pic.Draw (missle, bxr + 0, byt + bullet, picMerge)
View.Update
Pic.Draw (missle, bxr + 50, byt + bullet, picMerge)
bars
end for
end for
end if
end if
%/%%%%%%%%%%%%%%%%
% Normal Shoot %
%%%%%%%%%%%%%%%%\%
if chars ('z') then
if xx (1) > 0 then
for bullet : 1 .. maxy - (byt)
for x : 1 .. 1
bxr += +xl + xr
byt += +yb + yt
View.Update
Pic.Draw (background, 0, 0, picCopy)
Pic.Draw (sprite (xx (x)), bxr, byt, picMerge)
Pic.Draw (missle, bxr + 25, byt + bullet, picMerge)
bars
end for
end for
end if
end if
end shoot
procedure fly
View.Set ("offscreenonly,nobuttonbar")
setscreen ("graphics:maxx;maxy,noecho,nocursor")
View.Update
%/%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input Keys For Plane %
%%%%%%%%%%%%%%%%%%%%%%%%%%\%
loop
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
for x : 1 .. 1
xx (x) := x
yt := 4
end for
elsif chars (KEY_RIGHT_ARROW) then
for x : 1 .. 1
xx (x) := 2
xr := 4
end for
elsif chars (KEY_DOWN_ARROW) then
for x : 1 .. 1
xx (x) := x
yb := yb - 4
end for
elsif chars (KEY_LEFT_ARROW) then
for x : 1 .. 1
xx (x) := x + 2
xl := xl - 4
end for
end if
fork shoot
%/%%%%%%%%%%%%%%%%%%%
% Move Airplane %
%%%%%%%%%%%%%%%%%%%\%
if xx (1) > 0 then
for x : 1 .. 1
bxr += +xl + xr
byt += +yb + yt
View.Update
Pic.Draw (background, 0, 0, picCopy)
Pic.Draw (sprite (xx (x)), bxr, byt, picMerge)
bars
end for
View.Update
end if
%/%%%%%%%%%%%%%%%%%
% Clear Modes %
%%%%%%%%%%%%%%%%%\%
xl := 0
xr := 0
yt := 0
yb := 0
end loop
end fly
/***************************************************************
* Game Run Code *
***************************************************************/
loop
fork enemy
fly
end loop |