What is it you are trying to achieve?
I would like my "house" procedure to happen when someone clicks in that specific box.
What is the problem you are having?
Everytime I click in that box in the corner, the house procedure does not work.
Describe what you have tried to solve this problem
I put mouse input into a if statement so if you click the button, the house procedure should happen.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Btw, the main program is at the end.
Turing: |
%-------------------------Screen-----------------------------------------------
setscreen ("graphics:max;max")%Uses the whole run window
%%%%%%%%%%%%%%%%%%%%End Of Year Scene%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------Loading Screen---------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var x : int %Variable for colour
var a : int := 0 %Variable for X coordinate value
var loading : int := Font.New ("Harrington:100") %Font for the loading screen
var now : int := Font.New ("Impact:72") %Font for brief message
var exitvar : boolean := false
loop %Starts a loop
randint (x, 1, 50) %Selects a random integer for this variable
a := a + 1 %Makes circles move
drawfilloval (a, 50, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 125, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 200, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 275, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 350, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 425, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 500, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 575, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 650, 50, 50, x ) %Draws circle with random circle
drawfilloval (a, 725, 50, 50, x ) %Draws circle with random circle
delay (0) %Extra code (no effect)-(Changeable)
Font.Draw ("NOW LOADING...", maxx div 7, maxy div 2,loading, black)%Draws the loading words
exit when a = maxx %Exits the loop when circles reach the end
end loop %Ends the loop
drawfillbox (0, 0, maxx, maxy, red) %Draws a background for message
Font.Draw ("HERE WE GO!!", maxx div 3, maxy div 2,now, white) %Draws a brief message
delay(1000) %Slows the speed
cls %Clears the screen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------Scene 1 Variables------------------------------------
var cloudx : int := 150 %Initial value of cloud1
var cloudcolour1 : int %Sets up cloud1 colour
var cloudcolour2 : int %Sets up cloud2 colour
var lleg,larm : int := 460 %Initial value of left body parts
var rleg,rarm : int := 490 %Initial value of right body parts
var stick2 : int := 475 %Initial value of 2nd X coordinates
var next : int := Font.New ("Times New Roman:20") %Font for the Next button
%-------------------------School Variables-------------------------------------
var schoolletter : int := Font.New ("Algerian:35") %Font for the school
var titan : int := Pic.FileNew ("Titan.jpg") %Titan image
%-------------------------Music Scene 1----------------------------------------
process Music1 %Music process
Music.PlayFile ("Schools Out.mp3") %Plays the music
if exitvar = true then
Music.PlayFileStop
end if
end Music1 %Ends the Music process
fork Music1 %Enables Music to play in background
%-------------------------Background-------------------------------------------
drawfillbox (0, 0, maxx, maxy, 53)%Sets the sky
drawfillbox (0, 0, maxx, maxy div 5, green)%Sets the grass
%-------------------------Moving Cloud 1---------------------------------------
process cloud1move %Cloud process
var count : int := 0
loop %Starts a loop
exit when exitvar = true
count := count + 1
randint (cloudcolour1, 1, 50) %Selects a random integer for this variable
for c : 100 .. 600 %Starts a counting loop
drawfilloval (c + 0, maxy - 60, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 0, maxy - 40, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 10, maxy - 50, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 20, maxy - 40, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 40, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 60, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 70, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 60, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 50, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 60, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 55, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 50, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 30, 30, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 80, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 80, maxy - 60, 25, 20, cloudcolour1 ) %Draws a circle which moves
exit when exitvar = true
delay (20) %Slows the speed
drawfilloval (c + 0, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 0, maxy - 40, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 10, maxy - 50, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 20, maxy - 40, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 40, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 50, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 55, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 50, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 30, 30, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 80, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 80, maxy - 60, 25, 20, 53) %Draws a circle which moves
exit when exitvar = true
%..........................Procede To Next Scene...............................
if count = 5 then %Conditional statement when count = 5
drawfillbox (1200, 30, 1300, 80, 42)%Draws a box
Font.Draw ("Next ->", 1210, 47,next, 1)%Draws the word next
var l,r,button : int %Variables for Mouse.Where
Mouse.Where(l,r,button ) %Finds the mouse input
if button = 1 then %2nd conditional statement when the left mouse button is pressed
if l > 1200 and l < 1300 and r > 30 and r < 80 then %3rd conditional statement inside the box
exitvar := true
Music.PlayFileStop %Stops the music
cls %Clears screen
cls %Clears screen
end if %Ends 3rd conditional statement
end if %Ends 2nd conditional statement
end if %Ends conditional statement
%.........................Continue Cloud Movement..............................
exit when exitvar = true
end for %Ends counting loop
exit when exitvar = true
end loop %Ends loop
end cloud1move %Ends the Cloud process
%-------------------------Moving Cloud 2---------------------------------------
process cloud2move %Cloud process
loop %Starts a loop
exit when exitvar = true
randint (cloudcolour2, 1, 50) %Selects a random integer for this variable
for c : 800 .. maxx %Starts a counting loop
drawfilloval (c + 0, maxy - 60, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 0, maxy - 40, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 10, maxy - 50, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 20, maxy - 40, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 40, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 60, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 70, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 60, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 50, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 60, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 55, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 50, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 30, 30, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 80, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 80, maxy - 60, 25, 20, cloudcolour2 ) %Draws a circle which moves
exit when exitvar = true
delay (20) %Slows the speed
drawfilloval (c + 0, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 0, maxy - 40, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + 10, maxy - 50, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 20, maxy - 40, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 40, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 30, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 40, maxy - 50, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 60, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 55, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 50, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 40, 30, 30, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 50, maxy - 80, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 60, maxy - 70, 20, 20, 53) %Draws a circle which moves
exit when exitvar = true
drawfilloval (c + - 80, maxy - 60, 25, 20, 53) %Draws a circle which moves
exit when exitvar = true
end for %Ends the counting loop
exit when exitvar = true
end loop %Ends the loop
end cloud2move %Ends the Cloud process
%-------------------------School-----------------------------------------------
drawfillbox (0, maxy div 5, 400, maxy div 2, 137)%School Frame
Font.Draw ("York Mills C.I.", 20, 275, schoolletter, red)%Puts York text on the school
% Window-Left
drawfillbox (50, 200, 100, 250, cyan)%Left window colour
drawline (50, 225, 100, 225, white)%Left window, horizontal cross
drawline (75, 200, 75, 250, white)%Left window, vertical cross
drawbox (50, 200, 100, 250, white)%Left window frame
% Window-Right
drawfillbox (300, 200, 350, 250, cyan)%Right window colour
drawline (300, 225, 350, 225, white)%Right window, horizontal cross
drawline (325, 200, 325, 250, white)%Right window, vertical cross
drawbox (300, 200, 350, 250, white)%Right window frame
% Titan
Pic.Draw (titan, 150, 133, picCopy)%Puts image on school
% Stairs
drawfillbox (400, maxy div 5, 450, 150, grey)%First Stair
drawfillbox (400, maxy div 5, 425, 165, grey)%Second Stair
%--------------------------Students Leaving------------------------------------
process students %Student process
loop %Starts a loop
var lleg,larm : int := 460 %Previous variables
var rleg,rarm : int := 490 %Previous variables
var stick2 : int := 475 %Previous variables
drawline (lleg, 127,stick2, 150, black)%Student left leg
drawline (rleg, 127,stick2, 150, black)%Student right leg
drawline (stick2, 150,stick2, 170, black)%Student body
drawline (larm, 147,stick2, 170, black)%Student left arm
drawline (rarm, 147,stick2, 170, black)%Student right arm
drawfilloval (stick2, 180, 10, 10, black)%Student head
loop %Starts a 2nd loop
drawline (lleg, 127,stick2, 150, black)%Student left leg
drawline (rleg, 127,stick2, 150, black)%Student right leg
drawline (stick2, 150,stick2, 170, black)%Student body
drawline (larm, 147,stick2, 170, black)%Student left arm
drawline (rarm, 147,stick2, 170, black)%Student right arm
drawfilloval (stick2, 180, 10, 10, black)%Student head
lleg := lleg + 1 %Moves left leg
rleg := rleg + 1 %Moves right leg
larm := larm + 1 %Moves left arm
rarm := rarm + 1 %Moves right arm
stick2 := stick2 + 1 %Moves body and head
delay (5) %5 millisecond delay
drawline (lleg - 1, 127,stick2 - 1, 150, 53)%Student left leg
drawline (rleg - 1, 127,stick2 - 1, 150, 53)%Student right leg
drawline (stick2 - 1, 150,stick2 - 1, 170, 53)%Student body
drawline (larm - 1, 147,stick2 - 1, 170, 53)%Student left arm
drawline (rarm - 1, 147,stick2 - 1, 170, 53)%Student right arm
drawfilloval (stick2 - 1, 180, 10, 10, 53)%Student head
exit when stick2 = maxx %Exits 2nd loop when student reaches the end
if stick2 = maxx div 2 then %Conditional statement when student reaches middle
drawline (460, 127, 475, 150, black)%Student left leg
drawline (490, 127, 475, 150, black)%Student right leg
drawline (475, 150, 475, 170, black)%Student body
drawline (460, 147, 475, 170, black)%Student left arm
drawline (490, 147, 475, 170, black)%Student right arm
drawfilloval (475, 180, 10, 10, black)%Student head
end if %Ends conditional statement
exit when exitvar = true
end loop %Ends 2nd loop
exit when exitvar = true
end loop %Ends loop
end students %Ends student process
%%%%%%%%%%%%%%%%%%%%%%%%%%%%HOUSE SCENE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure house
drawfillbox (0, 0, maxx, maxy, 42) %Sets the background room colour
drawfillbox (80, 175, 100, 275, 137) %Left bed pillar
drawfilloval (90, 290, 15, 15, yellow) %Left bed pillar sphere
drawfillbox (100, 200, 300, 260, blue) %Draws the bed
drawfillbox (280, 175, 300, 275, 137) %Right bed pillar
Draw.ThickLine (100, 270, 120, 260, 5, white) %Draws the pillow
drawfilloval (700, 220, 150, 20, brightred) %Draws the outer part of the rug
drawfilloval (700, 220, 85, 10, brightgreen) %Draws the middle part of the rug
drawfilloval (700, 220, 30, 5, yellow) %Draws the inner part of the rug
Draw.ThickLine (550, 220, 525, 220, 3, yellow) %Left ruglet
Draw.ThickLine (580, 235, 560, 250, 3, yellow) %1st top ruglet
Draw.ThickLine (625, 240, 615, 260, 3, yellow) %2nd top ruglet
Draw.ThickLine (675, 242, 673, 262, 3, yellow) %3rd top ruglet
Draw.ThickLine (725, 242, 727, 262, 3, yellow) %4th top ruglet
Draw.ThickLine (775, 240, 780, 260, 3, yellow) %5th top ruglet
Draw.ThickLine (818, 235, 832, 255, 3, yellow) %6th top ruglet
Draw.ThickLine (850, 220, 880, 220, 3, yellow) %Right ruglet
Draw.ThickLine (818, 205, 832, 185, 3, yellow) %6th bottom ruglet
Draw.ThickLine (775, 201, 780, 180, 3, yellow) %5th bottom ruglet
Draw.ThickLine (725, 198, 727, 175, 3, yellow) %4th bottom ruglet
Draw.ThickLine (675, 198, 673, 175, 3, yellow) %3rd bottom ruglet
Draw.ThickLine (625, 201, 615, 178, 3, yellow) %2nd bottom ruglet
Draw.ThickLine (580, 206, 560, 185, 3, yellow) %1st bottom ruglet
end house
%%%%%%%%%%%%%%%%%%%%%%%%%%%MAIN PROGRAM%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fork cloud1move %Enables multiple animation at the same time
fork cloud2move %Enables multiple animation at the same time
fork students %Enables multi-animation
delay (0)
var l,r,button : int %Variables for Mouse.Where
Mouse.Where(l,r,button ) %Finds the mouse input
if button = 1 then %Conditional statement when the left mouse button is pressed
if l > 1200 and l < 1300 and r > 30 and r < 80 then %2nd conditional statement inside the box
house
end if %Ends 2nd conditional statement
end if %Ends conditional statement
|
Please specify what version of Turing you are using
Turing 4.1.1 |