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

Username:   Password: 
 RegisterRegister   
 Mouse.ButtonMoved HELP!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
johnwall_roty




PostPosted: Wed Jun 15, 2011 5:08 pm   Post subject: Mouse.ButtonMoved HELP!

What I am trying to do is to make a car move when the light changes according to the colour. I have this hooked up to a stoplight I made with the parallel put command. The problem is that I need it to change when I click, and to cycle when I dont click. This is really fustrating me.... HELPPP


Turing:


var carX, carY : int := 0
var x, y, buttonNum, buttonState : int
var dir : string := "stop"
var count : int := 0
setscreen ("graphics:max,max")

loop

    for countGreen : 1 .. 750
        dir := "go"
        %parallelput (1)
        drawfilloval (carX + 60, carY, 60, 40, green)
        drawfillbox (carX, carY, carX + 120, carY + 5, white)
        drawfilloval (carX + 20, carY + 10, 10, 10, black)
        drawfilloval (carX + 100, carY + 10, 10, 10, black)
        delay (10)
        drawfilloval (carX + 60, carY, 60, 40, white)
        drawfillbox (carX, carY, carX + 120, carY + 5, white)
        drawfilloval (carX + 20, carY + 10, 10, 10, white)
        drawfilloval (carX + 100, carY + 10, 10, 10, white)
        drawbox ((maxx div 2) - 30, (maxy div 2) + 75, (maxx div 2) + 30, (maxy div 2) - 75, black)
        drawoval (maxx div 2, (maxy div 2) + 50, 20, 20, black)
        drawoval (maxx div 2, maxy div 2, 20, 20, black)
        drawoval (maxx div 2, (maxy div 2) - 50, 20, 20, black)
        drawfill (maxx div 2, (maxy div 2) - 50, 48, black)
        drawfill (maxx div 2, (maxy div 2) + 50, 4, black)
        drawfill (maxx div 2, maxy div 2, 116, black)
        if dir = "go" then
            carX := carX + 5
        end if
        if carX > maxx + 120 then
            carX := 0
        end if
    end for



    for countYellow : 1 .. 100
        dir := "RunTheRed"
        %parallelput (2)
        drawfilloval (carX + 60, carY, 60, 40, green)
        drawfillbox (carX, carY, carX + 120, carY + 5, white)
        drawfilloval (carX + 20, carY + 10, 10, 10, black)
        drawfilloval (carX + 100, carY + 10, 10, 10, black)
        delay (10)
        drawfilloval (carX + 60, carY, 60, 40, white)
        drawfillbox (carX, carY, carX + 120, carY + 5, white)
        drawfilloval (carX + 20, carY + 10, 10, 10, white)
        drawfilloval (carX + 100, carY + 10, 10, 10, white)
        drawbox ((maxx div 2) - 30, (maxy div 2) + 75, (maxx div 2) + 30, (maxy div 2) - 75, black)
        drawoval (maxx div 2, (maxy div 2) + 50, 20, 20, black)
        drawoval (maxx div 2, maxy div 2, 20, 20, black)
        drawoval (maxx div 2, (maxy div 2) - 50, 20, 20, black)
        drawfill (maxx div 2, (maxy div 2) - 50, green, black)
        drawfill (maxx div 2, (maxy div 2) + 50, 111, black)
        drawfill (maxx div 2, maxy div 2, yellow, black)
        if dir = "RunTheRed" then
            carX := carX + 10
        end if
        if carX > maxx + 120 then
            carX := 0
        end if
    end for


    for countRed : 1 .. 500
        dir := "stop"
        %parallelput (8)
        drawfilloval (carX + 60, carY, 60, 40, green)
        drawfillbox (carX, carY, carX + 120, carY + 5, white)
        drawfilloval (carX + 20, carY + 10, 10, 10, black)
        drawfilloval (carX + 100, carY + 10, 10, 10, black)
        drawbox ((maxx div 2) - 30, (maxy div 2) + 75, (maxx div 2) + 30, (maxy div 2) - 75, black)
        drawoval (maxx div 2, (maxy div 2) + 50, 20, 20, black)
        drawoval (maxx div 2, maxy div 2, 20, 20, black)
        drawoval (maxx div 2, (maxy div 2) - 50, 20, 20, black)
        drawfill (maxx div 2, (maxy div 2) - 50, green, black)
        drawfill (maxx div 2, (maxy div 2) + 50, 12, black)
        drawfill (maxx div 2, maxy div 2, 116, black)
    end for


end loop




Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: