%Global Variables
var name : string
var continue : string
var coordinate1 : int
var coordinate2 : int
var font : int
var num1 : int
var num2 : int
font := Font.New ("Helvetica:14:bold")
procedure titlelogo
% find the path of the image, draw it into position and have it disappear
%local variable declaration
var picture : int := Pic.FileNew ("Battleshiplogo.bmp")
Pic.Draw (picture, maxx div 10, maxy div 10, 0)
delay (2000)
cls
%Authors and small description
put "" : 23, "Trouble in the Third Sea"
put ""
put "Ahoy mate! So you're the new recruit, eh? It's nice to always have a new member around here. Why don't you tell me your name first?"
end titlelogo
procedure askname
%ask the user for their name
get name
put "Arr, it's a pleasure to meet you, ", name, "!"
put "What say we bring you into battle for the first time? On this wide sea there are two ships, and they've got lots of supplies there, lots of food,"
put "like fish, meat, some vegetables, Arr, I'm gettin hungry now...Oops, arr, looks like I got carried away!"
put ""
put "Anyways, what I'm sayin' is that there are two enemy ships, and they've got supplies. If we don't destroy 'em fast, then it's gonna give them there"
put "enemies at an advantage. So what say, let's get started!"
get continue
put "I gotcha mate, that's the spirit! Let's go!"
end askname
procedure renderboard
setscreen ("graphics:900;630")
drawbox (120, 10, 10, 120, black)
drawbox (120, 240, 10, 120, black)
drawbox (120, 360, 10, 120, black)
drawbox (120, 480, 10, 120, black)
drawbox (120, 600, 10, 120, black)
drawbox (240, 10, 10, 120, black)
drawbox (360, 10, 10, 120, black)
drawbox (480, 10, 10, 120, black)
drawbox (600, 10, 10, 120, black)
drawbox (240, 120, 120, 240, black)
drawbox (240, 360, 10, 120, black)
drawbox (240, 480, 10, 120, black)
drawbox (240, 600, 10, 120, black)
drawbox (360, 120, 240, 360, black)
drawbox (360, 240, 240, 360, black)
drawbox (360, 480, 240, 360, black)
drawbox (360, 600, 240, 360, black)
drawbox (480, 120, 360, 480, black)
drawbox (480, 240, 360, 480, black)
drawbox (480, 360, 360, 480, black)
drawbox (480, 480, 360, 480, black)
drawbox (480, 600, 360, 480, black)
drawbox (600, 120, 480, 600, black)
drawbox (600, 240, 480, 600, black)
drawbox (600, 360, 480, 600, black)
drawbox (600, 480, 480, 600, black)
drawbox (600, 480, 480, 600, black)
end renderboard
procedure turn
put "Select the X coordinate, between 1 and 5: " ..
get coordinate1
put "Select the Y coordinate, between 1 and 5: " ..
get coordinate2
end turn
procedure declaregrid
% random variables
randint (num1, 1, 5)
% multiply any number from 1 to 5 by 120 to match the coordinate
num1 := num1 * 120
randint (num2, 1, 5)
if num2 = 1 then
num2 := num2 * 10
% For 2 the coordinates are different, they have to be multiplied by certain numbers
elsif num2 = 2 then
num2 := num2 * 60
% else 3, 4 or 5 it can just multiply by 120
else
num2 := num2 * 120
end if
end declaregrid
procedure randomship
for counter4 : num1 * 120 .. num1
end randomship
|