Message
Message
% Declaration of Constants
const BLUE := 54
const DARKBLUE := 104
const DARKERGREY := 28
const DARKGREEN := 119
const GREY := 29
const LIGHTBLUE := 53
const PALE := 92
const PEACH := 90
const PINK := 60
const RED := 12
const SKYBLUE := 101
const YELLOW := 44
const HEADER := Font.New ("arial:36:bold")
const TEXT := Font.New ("roboto:12")
% Declaration of Variables
var KeyPress : string (1)
var x1, x2, x3, x4, y1, y2, y3, y4, y5, y6, y7, y8, y9, r1, r2 : int
var EraseColour, FireworkOutline, TorsoColour, FireworkExplode : int
var LegColour, HeadColour, TitleDrawBackgroundColour : int
var DescDrawBackgroundColour, FireworkColour, StartDrawBackgroundColour : int
var ExitTextColour, StarColour, Outline, BuildingColour : int
var BuildingColourShade, FlagPole, Moon, Grass, DrawBackgroundColour : int
var xmouse, ymouse, button : int
% Variable Assignment
y1 := 40
y2 := 100
x1 := maxx div 2 - 35
x2 := maxx div 2 + 35
x3 := maxx div 2 - 20
x4 := maxx div 2 + 20
y3 := 0
y4 := 10
y5 := 30
y6 := 40
y7 := 0
y8 := 40
y9 := 130
r1 := 1
r2 := 1
BuildingColour := GREY
BuildingColourShade := DARKERGREY
DescDrawBackgroundColour := SKYBLUE
DrawBackgroundColour := SKYBLUE
EraseColour := DARKBLUE
ExitTextColour := brightred
FireworkColour := brightred
FireworkExplode := brightred
FireworkOutline := black
FlagPole := GREY
Grass := DARKGREEN
HeadColour := black
LegColour := black
Moon := PALE
Outline := black
StartDrawBackgroundColour := DARKBLUE
StarColour := YELLOW
TitleDrawBackgroundColour := SKYBLUE
TorsoColour := black
% Keybinds
var Left : string := "a"
var Right : string := "d"
var Fire : string := "e"
var Customize : string := "c"
% Grass
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfillbox (0, 0, maxx, 100, Grass)
% Flag Pole
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawbox (250, 90, 253, 250, Outline)
% Canada Flag
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawbox (253, 168 + 30, 340, 218 + 30, Outline)
drawfillbox (254, 169 + 30, 339, 217 + 30, white)
drawfillbox (254, 169 + 30, 274, 217 + 30, brightred)
drawfillbox (319, 169 + 30, 339, 217 + 30, brightred)
drawfillmapleleaf (280, 175 + 30, 315, 215 + 30, brightred)
% Buildings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Building #1
drawbox (0, 100, 70, 260, Outline)
drawline (60, 270, 70, 260, Outline)
drawline (60, 270, 0, 270, Outline)
drawfill (50, 265, BuildingColour, Outline)
drawfill (30, 200, BuildingColour, Outline)
% Building #2
drawbox (80, 100, 150, 240, Outline)
drawline (140, 250, 70, 250, Outline)
drawline (150, 240, 140, 250, Outline)
drawline (80, 240, 70, 250, Outline)
% Building #3
drawbox (160, 100, 230, 280, Outline)
% Building #4
drawbox (450, 100, 520, 250, Outline)
% Building #5
drawline (515, 255, 515, 260, Outline)
drawline (590, 100, 590, 260, Outline)
drawline (515, 260, 590, 260, Outline)
% Building #6
drawline (620, 100, 620, 230, Outline)
drawline (620, 230, maxx, 230, Outline)
drawline (610, 240, 620, 230, Outline)
drawline (610, 100, 610, 240, Outline)
drawline (610, 240, maxx, 240, Outline)
end DrawBackground
% End of Draw DrawBackground Procedure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DrawBackground
x1 := x1 - 10
x2 := x2 - 10
x3 := x3 - 10
x4 := x4 - 10
drawfillbox (x1, y1, x2, y2, TorsoColour)
drawfillbox (x3, y7, x4, y8, LegColour)
drawfillbox (x3, y2, x4, y9, HeadColour)
end MoveLeft
% End of move character left procedure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i : 20 .. random
randint (randomx, 0, maxx)
randint (randomy, 290, maxy)
drawdot (randomx, randomy, StarColour)
end for
end DrawStars
% End of draw stars procedure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Firework going up
for i : 1 .. 10
delay (100)
y3 := y3 + 20
y4 := y4 + 20
y5 := y5 + 20
y6 := y6 + 20
r1 := 1
r2 := 1
delay (50)
DrawBackground
end for
% Firework explode
DrawBackground
drawfillbox (x1, y1, x2, y2, TorsoColour)
drawfillbox (x3, y7, x4, y8, LegColour)
drawfillbox (x3, y2, x4, y9, HeadColour)
delay (100)
for i : 1 .. 5
drawoval (x2, y6, r1, r2, FireworkExplode)
delay (100)
cls
DrawBackground
drawfillbox (x1, y1, x2, y2, TorsoColour)
drawfillbox (x3, y7, x4, y8, LegColour)
drawfillbox (x3, y2, x4, y9, HeadColour)
r1 := r1 + 5
r2 := r2 + 5
end for
DrawBackground
drawfillbox (x1, y1, x2, y2, TorsoColour)
drawfillbox (x3, y7, x4, y8, LegColour)
drawfillbox (x3, y2, x4, y9, HeadColour)
end ShootFirework
% End of shoot fireworks procedure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Firework going up
for i : 1 .. 10
delay (100)
y3 := y3 + 20
y4 := y4 + 20
y5 := y5 + 20
y6 := y6 + 20
r1 := 1
r2 := 1
delay (50)
drawbox (x2 - 10, y4, x2, y5, EraseColour)
drawline (x2 - 5, y3, x2 - 5, y4, EraseColour)
DrawBackground
end for
% Firework explode
DrawBackground
drawfillbox (x1, y1, x2, y2, TorsoColour)
drawfillbox (x3, y7, x4, y8, LegColour)
drawfillbox (x3, y2, x4, y9, HeadColour)
delay (100)
for i : 1 .. 5
drawoval (x2, y6, r1, r2, FireworkExplode)
delay (100)
cls
DrawBackground
drawfillbox (x1, y1, x2, y2, TorsoColour)
drawfillbox (x3, y7, x4, y8, LegColour)
drawfillbox (x3, y2, x4, y9, HeadColour)
r1 := r1 + 5
r2 := r2 + 5
end for
DrawBackground
drawfillbox (x1, y1, x2, y2, TorsoColour)
drawfillbox (x3, y7, x4, y8, LegColour)
drawfillbox (x3, y2, x4, y9, HeadColour)
end CustomFirework
% End of shoot fireworks procedure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
colourback (TitleDrawBackgroundColour)
cls
getch (KeyPress)
if KeyPress = chr (32) then
exit
end if
end loop
% Description Screen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
colourback (DescDrawBackgroundColour)
cls
getch (KeyPress)
if KeyPress = chr (32) then % (if spacebar is pressed)
exit
end if
end loop
% Draw Moon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfilloval (600, 365, 30, 30, Moon)
% Exit to Customize
getch (KeyPress)
if KeyPress = Customize then
exit
end if
% Shoot Firework
if KeyPress = Fire then
ShootFirework
end if
% Move Left
getch (KeyPress)
if KeyPress = Left then
MoveLeft
end if
% Move Right
if KeyPress = Right then
drawfillbox (x3, y2, x4, y9, EraseColour)
MoveRight
end if
end loop
% Customization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
colourback (white)
cls
% Character Customization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Option 1 (peach)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfillbox (maxx div 7 * 1, maxy div 2 - 50, maxx div 7 * 2, maxy div 2 + 50,
PEACH)
if xmouse > 77 and xmouse < 154 and ymouse > 149 and ymouse < 249 and button =
1 then
HeadColour := PEACH
cls
exit
end if
% Option 2 (yellow)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfillbox (maxx div 7 * 3, maxy div 2 - 50, maxx div 7 * 4, maxy div 2 + 50,
YELLOW)
if xmouse > 231 and xmouse < 308 and ymouse > 149 and ymouse < 249 and button =
1 then
HeadColour := YELLOW
cls
exit
end if
% Option 3 (black)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfillbox (maxx div 7 * 5, maxy div 2 - 50, maxx div 7 * 6, maxy div 2 + 50,
black)
if xmouse > 385 and xmouse < 462 and ymouse > 149 and ymouse < 249 and button =
1 then
HeadColour := black
cls
exit
end if
end loop
delay (200)
loop
mousewhere (xmouse, ymouse, button)
View.Update
if xmouse > 82 and xmouse < 207 and ymouse > 100 and ymouse < 300 and button =
1 then
TorsoColour := brightblue
LegColour := black
cls
exit
end if
if xmouse > 258 and xmouse < 382 and ymouse > 100 and ymouse < 300 and button =
1 then
TorsoColour := PINK
LegColour := black
cls
exit
end if
if xmouse > 432 and xmouse < 558 and ymouse > 100 and ymouse < 300 and button =
1 then
TorsoColour := black
LegColour := black
cls
exit
end if
end loop
delay (200)
% Firework Customization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Red Option
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfillbox (maxx div 7 * 1, maxy div 2 - 50, maxx div 7 * 2, maxy div 2 + 50,
brightred)
if xmouse > 77 and xmouse < 154 and ymouse > 149 and ymouse < 249 and button =
1 then
FireworkColour := brightred
FireworkExplode := brightred
cls
exit
end if
% Blue Option
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfillbox (maxx div 7 * 3, maxy div 2 - 50, maxx div 7 * 4, maxy div 2 + 50,
brightblue)
if xmouse > 231 and xmouse < 308 and ymouse > 149 and ymouse < 249 and button =
1 then
FireworkColour := brightblue
FireworkExplode := brightblue
cls
exit
end if
% Yellow Option 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfillbox (maxx div 7 * 5, maxy div 2 - 50, maxx div 7 * 6, maxy div 2 + 50,
YELLOW)
if xmouse > 385 and xmouse < 462 and ymouse > 149 and ymouse < 249 and button =
1 then
FireworkColour := YELLOW
FireworkExplode := YELLOW
cls
exit
end if
end loop
delay (200)
% Draw Moon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfilloval (600, 365, 30, 30, Moon)
loop
% Shoot Firework
if KeyPress = Fire then
CustomFirework
end if
% Move Left
getch (KeyPress)
if KeyPress = Left then
MoveLeft
end if
% Move Right
if KeyPress = Right then
drawfillbox (x3, y2, x4, y9, EraseColour)
MoveRight
end if
end loop