import GUI
%Sets the mode to graphics mode and changes the resolution
%It also positions it on the center of the screen with nobutton bar
setscreen ("graphics:700;420,position:center;center,nobuttonbar")
%
drawfillbox (0, 0, maxx, maxy, 186)
drawfillbox (190, 0, 530, 790, 68)
var back3 : int := Pic.New (0, 0, maxx, maxy)
var num : int := 1
const transname : array 1 .. 1 of string := init ("picFadeIn")
const trans : array 1 .. 1 of int := init (picFadeIn)
var transitions := upper (transname)
var font1 : int
font1 := Font.New ("serif:12:bold")
var x1, y1, b1 : int
drawfillbox (0, 0, 100, 50, black)
Font.Draw ("Enter House", 6, 20, font1, white)
loop
Mouse.Where (x1, y1, b1)
if b1 = 1 %mouse down
then
if y1 < 50 and x1 < 100 then
%basically you clicked inside the rectangle object
exit
else
end if
end if
end loop
Pic.DrawSpecial (back3, 0, 0, picCopy, trans (num), 2500)
delay (1500)
cls
%Room
%Refreshes the GUI
GUI.Refresh
%Sets the screen resolution in graphics mode and removes the buttonbar.
%It is positioned at the center of the screen
setscreen ("graphics:1150;690,position:center;center,nobuttonbar")
% Determine the number of frames in the gif
% Create the original picture
var numFrames := Pic.Frames ("Mario.gif")
% Loads the picture
var delayTime : int
var pic : array 1 .. numFrames of int
var TV : boolean := false
Pic.FileNewFrames ("Mario.gif", pic, delayTime)
%The procedure of the buttons is set
%Boolean is used
procedure button
TV := true
GUI.Refresh
end button
procedure button1
TV := false
GUI.Refresh
end button1
proc room
%Fills in the colour of the wall to green
drawfill (2, 180, 97, 97)
%Draws the edges of the room
drawline (1200, 0, 910, 180, black)
drawline (910, 180, 910, 900, black)
drawline (0, 180, 910, 180, black)
%Fills the floor with the colour grey with black borders
drawfill (100, 5, 30, black)
drawfillbox (0, 0, 200, 50, black)
Font.Draw ("Go to left side of the room", 6, 20, font1, white)
loop
Mouse.Where (x1, y1, b1)
if b1 = 1 %mouse down
then
if y1 < 50 and x1 < 200 then
%basically you clicked inside the rectangle object
cls
exit
else
end if
end if
end loop
%Fills in the colour of the wall to green
drawfill (2, 180, 97, 97)
%Draws the edges of the room
drawline (0, 0, 180, 180, black)
drawline (180, 180, 180, 900, black)
drawline (180, 180, 1500, 180, black)
%Fills the floor with the colour grey with black borders
drawfill (100, 5, 30, black)
%Draws a black television
drawfillbox (465, 225, 855, 552, black)
%Draws the screen for the television
drawfillbox (499, 255, 821, 531, 20)
%Draws the shelf holding the gaming system
drawfillbox (465, 215, 855, 150, black)
%Draws a column that holds up the shelf
drawfillbox (465, 230, 480, 150, black)
%Draws a column that holds up the shelf
drawfillbox (820, 230, 855, 150, black)
%Draws the gaming system
drawfillbox (580, 165, 730, 210, white)
%Draws the power button
drawfilloval (600, 185, 12, 12, grey)
%Draws the CD Rom on the gaming system
drawfillbox (625, 185, 695, 190, grey)
%Draws a line that seperates parts of the machine
drawfillbox (702, 165, 702, 210, black)
%Draws button/slot
drawfilloval (720, 175, 4, 4, black)
%Draws button/slot
drawfilloval (720, 195, 4, 4, black)
%Draws a line to make the shelf look 3-Dimensional
drawline (837, 150, 820, 215, white)
%Draws a line to make the shelf look 3-Dimensional
drawline (480, 150, 484, 215, white)
%Draws the back part of the gaming system
drawfillbox (580, 210, 728, 218, white)
%
%Draws the fish tank and water inside
drawfillbox (200, 450, 430, 460, black)
drawfillbox (200, 300, 198, 460, black)
%Draws the water in the tank
drawfillbox (200, 300, 430, 450, 101)
drawfillbox (431, 300, 433, 460, black)
drawfillbox (198, 300, 433, 290, black)
%declares the pic ID for storing the image
var picid : int
%Imports the controller into the program
picid := Pic.FileNew ("controller.bmp")
%Draws the controller and merges it in the background
Pic.Draw (picid, 550, -17, picMerge)
%Imports the gold fish into the program
var picid1 : int
picid1 := Pic.FileNew ("fish2.jpg")
%Draws a fish swimming across the fish tank
for k : 1 .. 130
Pic.Draw (picid1, 340 - k, 305, picMerge)
%Fish moves every 30 milliseconds
delay (30)
end for
%On and off buttons are created
var c : int := GUI.CreateButton (645, 228, 0, "On", button)
var quitBtn1 : int := GUI.CreateButton (695, 228, 0, "Off", button1)
drawfillbox (0, 0, 150, 50, black)
Font.Draw ("Return to first room", 6, 20, font1, white)
%Refresh the GUI
GUI.Refresh
%Starts a loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
Mouse.Where (x1, y1, b1)
if b1 = 1 %mouse down
then
if y1 < 50 and x1 < 150 then
%basically you clicked inside the rectangle object
%I want it to return to top part
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
else
%Checks if TV is true
if TV = true then
%Starts playing mario music (Looped)
Music.PlayFileLoop ("mario.mp3")
%Draws the frames of the picture (GIF)
Pic.DrawFrames (pic, 500, 250, picMerge, numFrames, 50, false)
%Checks if TV is false
elsif TV = false then
%Stops the music
Music.PlayFileStop
%Draws a grey box that covers the screen
drawfillbox (499, 250, 821, 531, 20)
end if
exit when GUI.ProcessEvent
end if
end if
end loop
%Loop ends
end room
proc show
%Fills in the colour of the wall to green
drawfill (2, 180, 97, 97)
%Draws the edges of the room
drawline (1200, 0, 910, 180, black)
drawline (910, 180, 910, 900, black)
drawline (0, 180, 910, 180, black)
%Fills the floor with the colour grey with black borders
drawfill (100, 5, 30, black)
drawfillbox (0, 0, 200, 50, black)
Font.Draw ("Go to left side of the room", 6, 20, font1, white)
loop
Mouse.Where (x1, y1, b1)
if b1 = 1 %mouse down
then
if y1 < 50 and x1 < 200 then
%basically you clicked inside the rectangle object
cls
room
else
end if
end if
end loop
end show
room
|