Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Someone explain why 3 procedures won't work??
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Honsly




PostPosted: Sat May 18, 2013 12:13 pm   Post subject: Someone explain why 3 procedures won't work??

What is it you are trying to achieve?
I'm am simply trying to get 3 procedures to happen simultaneously.


What is the problem you are having?
For some reason only 2 procedures work, the last won't doesn't happen.

Describe what you have tried to solve this problem
I've tried rearranging the, looping them etc. Nothing works, only 2.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Take a look

Turing:


%----------------------------------Man-----------------------------------------
procedure Bball
    drawline (30,0,80,150, black) %Left Leg
    drawline (80,150,125,0, black) %Right Leg
    drawline (80,150,80,300, black) %Body
    drawline (80,300,30,175, black) %Left Arm
    drawline (80,300,250,250, black) %Right Arm
    drawfilloval (80,350,50,50, black) %Head
    drawfilloval (250,225,25,25, 42) %BasketBall
end Bball

%-------------------------------Moving Arm-------------------------------------
procedure man
    loop
        var y : int := 300
        var b : int := 250
        loop
            drawline (80,300,250,b, black) %Right Arm Goes Up
            b := b + 1
            delay (10)
            drawline (80,300,250,b - 1, 0) %Right Arm Disappears
            exit when b = 300
        end loop
        loop
            drawline (80,300,250,y, black) %Right Arm Goes Down
            y := y - 1
            delay (10)
            drawline (80,300,250,y + 1, 0) %Right Arm Disappears
            exit when y = 250   
        end loop
    end loop
end man

%----------------------------------Ball----------------------------------------
procedure bouncy
    loop
        var x : int := 225
        var a : int := 25       
        loop
            drawfilloval (250,x,25,25, 42) %Ball Goes Down
            x := x - 2
            delay (5)
            drawfilloval (250,x + 2,25,25, 0) %Ball Disappears
            exit when x = 25
        end loop
        loop
            drawfilloval (250,a,25,25, 42) %Ball Goes Up
            a := a + 2
            delay (5)
            drawfilloval (250,a - 2,25,25, 0) %Ball Disappears
            exit when a = 225
        end loop
    end loop
end bouncy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bball
man
bouncy




Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Nathan4102




PostPosted: Sat May 18, 2013 1:14 pm   Post subject: RE:Someone explain why 3 procedures won\'t work??

Turing executes things in order, so what you're telling it to do is "Execute "Bball", then "man", then "bouncy"". To get them all going simultaneously, you need to loop your procedure calls, and remove the loops from inside your procedures.
Raknarg




PostPosted: Sat May 18, 2013 1:57 pm   Post subject: RE:Someone explain why 3 procedures won\'t work??

Right. See how when you call your second procedure, it goes into a loop? You never tell it to leave that loop, so it never gets to the third procedure.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: