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

Username:   Password: 
 RegisterRegister   
 Disabling certain sections of the screen
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tristanbryce7




PostPosted: Tue Jan 15, 2013 1:06 pm   Post subject: Disabling certain sections of the screen

I am trying to make it so that, i have four boxes (using drawbox) on the screen, and only one box is correct, so if the user clicks a wrong box (mousewhere), it draws a "wrong" picture, and also blacks out the box (drawfillbox). Now i want it so that if they click the same box again, nothing happens, how would I do that?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jan 15, 2013 2:22 pm   Post subject: RE:Disabling certain sections of the screen

how are you making it do "not nothing" (show code)?

The typical approach is
code:

if (conditions_to_do_something) and (has_not_done_this_before) then
   % do something
end if
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
tristanbryce7




PostPosted: Tue Jan 15, 2013 3:23 pm   Post subject: Re: Disabling certain sections of the screen

Well, I am using mousewhere inside a loop, so if they click it again it would execute again

its basically a quiz, and they have 4 options, and each box is an option, so if they don't click the right one, i want to just "disable" that set of co-ordinates so if they click there again (no matter how many times they do, (excluding the first time, in which it says "Wrong" and draws a Pic of a big X) the program doesnt do anything

Turing:

loop
    mousewhere (x, y, b)

    if b = 1 and x >= 48 and x <= 202 and y >= 505 and y <= 650 then
        Pic.Draw (picWrong, 50, 150, picCopy)

    elsif b = 1 and x >= 41 and x <= 233 and y >= 274 and y <= 441 then
        Pic.Draw (picWrong, 50, 190, picCopy)


        %Third Option
    elsif b = 1 and x >= 28 and x <= 239 and y >= 4 and y <= 207 then
        Pic.Draw (picWrong, 50, 210, picCopy)

    elsif b = 1 and x >= 1054 and x <= maxx and y >= 758 and y <= maxy then
        Pic.Draw (picCorrect, 50, 240, picCopy)
        exit

    end if
end loop




so say that they click on the third option, and it turns out to be wrong, i want it it so that they remain in the loop, but now that statement which says

Turing:


elsif b = 1 and x >= 28 and x <= 239 and y >= 4 and y <= 207 then


is unactive. I was thinking of somehow being able to make it false using booleans, b/c my friend said I should try that, but I don;t know how to make a bunch of co-ordinates "false"
Tony




PostPosted: Tue Jan 15, 2013 3:50 pm   Post subject: RE:Disabling certain sections of the screen

code:

... and option_three_active then
Pic.Draw (picWrong, 50, 210, picCopy)
...

where option_three_active is your boolean variable with the appropriate value set.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
tristanbryce7




PostPosted: Tue Jan 15, 2013 3:58 pm   Post subject: Re: Disabling certain sections of the screen

So then should i also
make option_three active false afterwards?
like
.. and option_three_active then
Pic.Draw (picWrong, 50, 210, picCopy)
option_three_active := false ... ?
Tony




PostPosted: Tue Jan 15, 2013 5:52 pm   Post subject: RE:Disabling certain sections of the screen

exactly!
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
tristanbryce7




PostPosted: Tue Jan 15, 2013 6:16 pm   Post subject: Re: Disabling certain sections of the screen

Thanks man!! Very Happy
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  [ 7 Posts ]
Jump to:   


Style:  
Search: