Someone explain why this procedure won't work??
Author |
Message |
Honsly
|
Posted: Thu May 16, 2013 6:03 pm Post subject: Someone explain why this procedure won't work?? |
|
|
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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Raknarg
|
Posted: Thu May 16, 2013 6:08 pm Post subject: RE:Someone explain why this procedure won\'t work?? |
|
|
First of all, tell me this: Why do you need to use processes?
Second, you call your if statement down there once. As soon as the program reache\s the point where you want to call house, it ends immediately. |
|
|
|
|
|
Honsly
|
Posted: Thu May 16, 2013 6:18 pm Post subject: Re: Someone explain why this procedure won't work?? |
|
|
I use processes because there's animations.
And so how can get the house procedure to happen. I added delays to the if statement at the end like a 10 min delay and it still won't show.
Do you know how to fix this, or at least have an idea? |
|
|
|
|
|
Nathan4102
|
Posted: Thu May 16, 2013 6:29 pm Post subject: RE:Someone explain why this procedure won\'t work?? |
|
|
Processes will make animations run horribly. This is how animations should be made:
Turing: |
var x1, x2, y1, y2 : int := 0
View.Set("offscreenonly")
Procedure Picture1 (x, y : int)
DrawTheStuff (Relative_To_X_&_Y )
end Procedure
Procedure Picture2 (x, y : int)
DrawTheStuff (Relative_To_X_&_Y )
end Picture2
%Repeat for all pictures
loop
MakeChangesToX/Y
Picture1 (x1, y1 )
Picture2 (x2, y2 )
View.Update
cls
delay(something )
end loop
|
|
|
|
|
|
|
Honsly
|
Posted: Thu May 16, 2013 6:31 pm Post subject: Re: Someone explain why this procedure won't work?? |
|
|
Thanks I guess, but I think I'm going to stick to processes for now, I just need some help with getting the second scene to come up. |
|
|
|
|
|
Raknarg
|
Posted: Thu May 16, 2013 6:36 pm Post subject: RE:Someone explain why this procedure won\'t work?? |
|
|
Well, is there any difference between this:
Turing: |
var ball1x, ball2y, ball1d, ball2d : int
ball1x := 50
ball2y := 50
ball1d := 2
ball2d := 2
process ball1
loop
ball1x + = ball1d
if ball1x > maxx then
ball1x := maxx
ball1d * = - 1
elsif ball1x < 0 then
ball1x := 0
ball1d * = - 1
end if
Draw.FillOval (ball1x, 200, 10, 10, black)
delay (5)
cls
end loop
end ball1
process ball2
loop
ball2y + = ball2d
if ball2y > maxy then
ball2y := maxy
ball2d * = - 1
elsif ball2y < 0 then
ball2y := 0
ball2d * = - 1
end if
Draw.Oval (200, ball2y, 10, 10, black)
delay (5)
cls
end loop
end ball2
fork ball1
fork ball2
|
and this?
Turing: |
var ball1x, ball2y, ball1d, ball2d : int
ball1x := 50
ball2y := 50
ball1d := 2
ball2d := 2
procedure ball1
ball1x + = ball1d
if ball1x > maxx then
ball1x := maxx
ball1d * = - 1
elsif ball1x < 0 then
ball1x := 0
ball1d * = - 1
end if
Draw.FillOval (ball1x, 200, 10, 10, black)
end ball1
procedure ball2
ball2y + = ball2d
if ball2y > maxy then
ball2y := maxy
ball2d * = - 1
elsif ball2y < 0 then
ball2y := 0
ball2d * = - 1
end if
Draw.Oval (200, ball2y, 10, 10, black)
end ball2
loop
ball1
ball2
delay (5)
cls
end loop
|
This is much more predictable too, and usable. Now you can get all your animations to sync with eachother rather than them just happening rather randomly in the background.
How about you loop around the house thing instead? |
|
|
|
|
|
Honsly
|
Posted: Thu May 16, 2013 6:58 pm Post subject: Re: Someone explain why this procedure won't work?? |
|
|
I tried the loop thing as well, it did not work. Any other ideas?? |
|
|
|
|
|
Nathan4102
|
Posted: Thu May 16, 2013 7:04 pm Post subject: RE:Someone explain why this procedure won\'t work?? |
|
|
Show us how you did the loop thing, and we'll show you where you went wrong. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Honsly
|
Posted: Thu May 16, 2013 7:08 pm Post subject: Re: Someone explain why this procedure won't work?? |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%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
loop
house
end loop
end if %Ends 2nd conditional statement
end if %Ends conditional statement
I also tried looping the actual procedure
procedure house
loop
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 loop
end house |
|
|
|
|
|
Raknarg
|
Posted: Thu May 16, 2013 7:11 pm Post subject: RE:Someone explain why this procedure won\'t work?? |
|
|
I mean loop around the end of your program |
|
|
|
|
|
Nathan4102
|
Posted: Thu May 16, 2013 7:13 pm Post subject: RE:Someone explain why this procedure won\'t work?? |
|
|
No loops inside the procedure. Follow the template I gave you earlier, and the animation will work. No matter what you do or how you do it though, you won't get a smooth animation with forks, Procedures are the way to go. |
|
|
|
|
|
Honsly
|
Posted: Thu May 16, 2013 8:15 pm Post subject: Re: Someone explain why this procedure won't work?? |
|
|
I tried your template as well, it completely stopped my program. |
|
|
|
|
|
Raknarg
|
Posted: Thu May 16, 2013 8:31 pm Post subject: RE:Someone explain why this procedure won\'t work?? |
|
|
because you need to change the stuff if you want yo use procedures. You can try looking at my two examples and see how they are different
Here's a reason why it won't ever work out smooth:
Turing: |
var x : int := 0
process rnd
loop
x + = 1
if x > 10 then
x := 1
end if
end loop
end rnd
fork rnd
loop
put x
delay (50)
end loop
|
Notice something weird? I'm getting 11s, even though I tell it to never go above 10. That's because it's unpredictable, and can't be synced with my main program. |
|
|
|
|
|
|
|