Disabling certain sections of the screen
Author |
Message |
tristanbryce7
|
Posted: 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
|
|
|
Tony
|
Posted: 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
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
tristanbryce7
|
Posted: 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
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
tristanbryce7
|
Posted: 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
|
|
|
|
|
tristanbryce7
|
Posted: Tue Jan 15, 2013 6:16 pm Post subject: Re: Disabling certain sections of the screen |
|
|
Thanks man!! |
|
|
|
|
|
|
|