% Remix version meant not to suck as much as origonal
% Remix by (NAME REMOVED)
% Constants %
const groundColour := 1
const missileColour1 := red
const missileColour2 := brightblue
const explosionColour := 2
const playerColour := blue
const turnDelay := 100
const outOfPlay := 0
var maxMissiles : int
maxMissiles := 100000
process song
Music.Play("1a4a<1a>4d4d4c<1a<1a>>4d4d4c<1a<la<lala>4a4a4b4b<1a<1a>4a4a4b4b<1a<1a>4a4a4b4b<1a<1a>>4d4d4c<1a<1a>4d4d4c<la<la>4a4a4b4b<1a<1a>4a4a4b4b<1a<1a")
end song
% Global Variables %
var playerSpeed : int
var choose : string
var numMissiles : int % the number of missiles in play
var evadedMissiles : int := 0 % total number of missiles evaded
var tx : int := maxx div 2 % the x position of the player in pixels
var ty : int := maxy div 2 % the y position of the player in pixels
var turns, timer, dist, font1 : int
var howmany : int
% This procedure gives the instructions for the game. %
font1 := Font.New("Bauhaus 93:40x50")
fork song
procedure Instructions
locate (1, 30)
delay(2000)
Font.Draw ("Missiles",53,203, font1, gray)
Font.Draw ("Missiles",47,197, font1, gray)
Font.Draw ("Missiles",50,200, font1, brightred)
delay(2000)
cls
colour(black)
colour(brightred)
put " Missiles Remix"
delay(400)
colour(brightgreen)
put " Try not to get hit. not that complex."
colour(black)
put skip
delay(400)
put "Normal game or Custom? (N or C)"
put "Normal uses the settings from the origonal game."
put "Custom allows you to choose your settings, making the game"
put "easier or harder, to your preferance."
put "What is typed in will not show up, just click enter after"
put "you designate your desired amount / command, even if it does"
put "not show up."
colour(black)
get choose
if (choose = "C") or (choose = "c") then
put "How many missles at start? (1 - 100000)"
get numMissiles
put "How many missles per turn? (1 - 50000)"
get howmany
put "What speed would you like to go? (1-100)"
get playerSpeed
else
numMissiles := 1
howmany := 1
playerSpeed:= 4
maxMissiles := 20
end if
colour(red)
put " Hit any key to start the game..."
Input.Pause
cls
end Instructions
% This procedure draws the player. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure DrawPlayer (clr : int)
Draw.FillBox (round (tx - 5), round (ty - 5), round (tx + 5), round (ty + 5), clr)
Draw.FillBox (round (tx - 4), round (ty - 4), round (tx + 4), round (ty + 4), clr)
Draw.FillBox (round (tx - 3), round (ty - 3), round (tx + 3), round (ty + 3), clr)
end DrawPlayer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This procedure handles any key strokes by reading any char %
% from the keyboard and moving the player in response to it. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure ControlPlayer
var x, y, b : int
Mouse.Where (x, y, b)
if b = 1 and (x not= tx or y not= ty) then
DrawPlayer (0)
var d : real := sqrt ((x - tx) ** 2 + (y - ty) ** 2)
var dx : int := round ((x - tx) * playerSpeed / d)
var dy : int := round ((y - ty) * playerSpeed / d)
if abs (dx) > abs (x - tx) then
tx := x
else
tx := tx + dx
end if
if abs (dy) > abs (y - ty) then
ty := y
else
ty := ty + dy
end if
% Make certain the player doesn't go off the screen.
if tx < 10 then
tx := 10
elsif tx > maxx - 10 then
tx := maxx - 10
end if
if ty < 10 then
ty := 10
elsif ty > maxy - 10 then
ty := maxy - 10
end if
% Draw the player in its new position
DrawPlayer (playerColour)
end if
end ControlPlayer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main Body %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var px, py : array 1 .. maxMissiles of int
% The position array for the missiles
var vx, vy : array 1 .. maxMissiles of int
% The velocity array for the missiles
randomize
setscreen ("graphics,noecho")
Instructions
loop
% Initialize the missile array.
for i : 1 .. numMissiles
px (i) := Rand.Int (0, maxx)
py (i) := 0
vx (i) := 0
vy (i) := Rand.Int (1, 5)
end for
% Draw the screen
cls
drawline (0, 0, maxx, 0, 1)
DrawPlayer (playerColour)
% Set the clock and number of elapsed turns
turns := 0
% The main loop
loop
turns += 1
% For each missile: determine the new x velocity
% determine the new y velocity
% set the new missile position
% draw a travel line
% check to see if it hit the ground
% check to see if it hit the player
for i : 1 .. numMissiles
const ox : int := px (i)
const oy : int := py (i)
if ox not= outOfPlay then
% Determine the x velocity
dist := abs (vx (i)) * (abs (vx (i)) + 1) div 2
if vx (i) < 0 and ox - dist < 0 then
vx (i) += 2
elsif vx (i) > 0 and ox + dist > maxx then
vx (i) -= 2
elsif turns > 100 then
if turns mod 20 = 0 then
vx (i) -= sign (vx (i))
end if
elsif ox < tx then
vx (i) += 1
elsif ox > tx then
vx (i) -= 1
end if
% Determine the y velocity
dist := abs (vy (i)) * (abs (vy (i)) + 1)div 2
if vy (i) > 0 and oy + dist > maxy then
vy (i) -= 2
elsif turns > 100 then
if turns mod 8 = 0 then
vy (i) -= 1
end if
elsif vy (i) < 0 and oy - dist < -turns div 15 then
vy (i) += 2
elsif oy < ty then
vy (i) += 1
elsif oy > ty then
vy (i) -= 1
end if
% Set the new missile position
px (i) += vx (i)
py (i) += vy (i)
% Draw a travel line
if turns > 100 then
Draw.FillStar (ox, oy, px (i), py (i), missileColour2)
else
Draw.ThickLine (ox, oy, px (i), py (i),3, missileColour1)
Draw.ThickLine (ox, oy, px (i), py (i),2, brightgreen)
Draw.ThickLine( ox, oy, px (i), py (i),1, brightred)
end if
% Check to see if it hit the ground
if py (i) <= 0 then
drawline (px (i), 0, px (i) - 10, 10, explosionColour)
drawline (px (i), 0, px (i), 10, explosionColour)
drawline (px (i), 0, px (i) + 10, 10, explosionColour)
px (i) := outOfPlay
evadedMissiles += 1
end if
% Check to see if it hit the player
if Math.DistancePointLine (tx, ty, ox, oy, px (i), py (i)) < 3 then
drawfillstar (tx - 7, ty - 7, tx + 7, ty + 7, brightblue)
locate (10, 5)
for flash :1 .. 1000
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",100,200, font1, brightred)
delay (300)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",100,200, font1, red)
delay(200)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",100,200, font1, black)
delay(300)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",100,200, font1, red)
delay(300)
colour(black)
put "You lost miserably after ", evadedMissiles, " missiles..." ..
locate(2,2)
end for
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",97,197, font1, gray)
Font.Draw ("FAILURE",100,200, font1, brightred)
delay (500)
return
end if
end if
end for
% Check if the player is being controlled
ControlPlayer
% This is a timer delay loop to make sure that each turn takes
% the same length of time to execute, regardless of the number
% of missiles on the screen
Time.DelaySinceLast (30)
% This will leave the loop when all the missiles have crashed.
var endNow : boolean := true
for i : 1 .. numMissiles
if px (i) not= outOfPlay then
endNow := false
end if
end for
exit when endNow
end loop
% After each time all the missiles have crashed, add 1 to the number
% of missiles with a maximum of maxMissiles.
numMissiles += howmany
if numMissiles > maxMissiles then
numMissiles := maxMissiles
end if
end loop
|