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

Username:   Password: 
 RegisterRegister   
 Processes problem! Desparate!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wk1989




PostPosted: Tue Jun 07, 2005 8:30 pm   Post subject: Processes problem! Desparate!!!

I have a program where user have to shoot the balloons, I tried to avoid processes, but it's impossible to because input from the mouse is required all times!!!! Please help me! This is my program, and I don't want any prcoesses because this is only one part, the whole thing executes 3-4 small programs, I'd like to be able to stop a processes after a certain procedure is done, is it possible to do that with Turing?

Here's the program please take a look at it!!!
thx

code:


    setscreen ("graphics:1000;650,offscreenonly")
    var font2, numberOfBalloons, balloonX, balloonY, balloon1X, balloon1Y, increase, counter : int
    var mouseX, mouseY, mouseB : int
    var score : string
    counter := 0

 font2 := Font.New ("sans serif:18:bold")

    %Balloon1 procedure.
    balloon1Y := 130
    balloon1X := 30
    balloonX := 12
    balloonY := 30
    %Process
    process check
        loop
            for i : 1 .. 2
                mousewhere (mouseX, mouseY, mouseB)
             
                if mouseB not= 0 and whatdotcolor (mouseX, mouseY) not= 0 then

                    drawfilloval (mouseX, mouseY, 50, 50, red)
                    counter += 5

                    View.Update


                    delay (20)
                    cls
                end if

            end for
        end loop
    end check
    fork check

 

    procedure balloon1


        for rising : 1 .. 1

            randint (balloonX, 1, maxx)
            randint (increase, 5, 40)
            drawfilloval (balloon1X, balloon1Y, 50, 50, blue)
            drawline (balloon1X, balloon1Y - 50, balloon1X, balloon1Y - 150, black)

            if balloon1Y > maxy then
                balloon1Y := 25
            end if
            balloon1Y := balloon1Y + 50
            randint (balloon1X, 1, maxx)


            %Second balloon
            randint (balloonX, 50, 500)

            randint (increase, 5, 40)
            drawfilloval (balloonX, balloonY, 50, 50, 3)
            drawline (balloonX, balloonY - 50, balloonX, balloonY - 150, black)

            if balloonY > maxy then
                balloonY := 15
            end if
            balloonY := balloonY + increase
            delay (150)
            score := intstr (counter, 4, 10)
            Font.Draw (score, 20,20, font2, red)

 

            %checks mouse position
       


            View.Update
            delay (250)
            cls

 

        end for

 

 

    end balloon1


    loop
        balloon1
    end loop



Sponsor
Sponsor
Sponsor
sponsor
lyam_kaskade




PostPosted: Tue Jun 07, 2005 8:48 pm   Post subject: (No subject)

Change the check process to a procedure, get rid of the and the for loop inside of it, and call the check procedure inside of the balloon procedure. Tweak it a bit to work out the speed, and it should work.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: