Computer Science Canada Need help with Mouse.Where |
Author: | Dittatore [ Thu Apr 11, 2013 5:11 pm ] |
Post subject: | Need help with Mouse.Where |
Mouse.Where (x, y, button) if x >= 323 and x <= 328 and y >= 195 and y <= 205 and button = 1 then drawfilloval (x, y, 10, 10, black) end if Can anyone please tell me how to repeat "if x >= (n) and x <= (n) and y >= (n) and y<= (n) and button = 1 then" without actually typing that almost exact line 225 times? |
Author: | Nathan4102 [ Thu Apr 11, 2013 5:17 pm ] | ||
Post subject: | RE:Need help with Mouse.Where | ||
This would repeat the code inbetween the for's 225 times. Is this what you're looking for? |
Author: | Panphobia [ Thu Apr 11, 2013 5:18 pm ] | ||
Post subject: | RE:Need help with Mouse.Where | ||
Elaborate please, by repeat do mean to do it over and over again, if so you can just use a loop, and also you can simplify your second if statement of "if x >= (n) and x <= (n) and y >= (n) and y<= (n) and button = 1 then" to "if x = (n) and y = (n) and button = 1 then", that would only be if you are using the same number for all of them, otherwise you should call them differently like "if x >= (n) and x <= (a) and y >= (b) and y<= (e) and button = 1 then", you can use the for loop like Nathan said, or if you do not know how many times you want to repeat it just use
|
Author: | Dittatore [ Thu Apr 11, 2013 5:39 pm ] |
Post subject: | Re: Need help with Mouse.Where |
Quote: Elaborate please
Sorry, I should've make it more clear. The code should be "if x >= (n) and x <= (a) and y >= (b) and y<= (e) and button = 1 then". The number for (n), (a), (b), (e) would be different each time. |
Author: | Clayton [ Fri Apr 12, 2013 7:48 am ] |
Post subject: | RE:Need help with Mouse.Where |
The answer to your question very much depends on what the expected values of n, a, b, and e are. If they are multiples of each other, or have some sort of distinguishable pattern, then yes, this can be easily done in a few simple lines of code. What exactly is it that you're trying to do here? A full explanation would help a lot with figuring out how to help you ![]() |
Author: | Dittatore [ Wed Apr 17, 2013 3:59 pm ] |
Post subject: | Re: Need help with Mouse.Where |
Quote: What exactly is it that you're trying to do here?
I'm trying to make a game called Gomoku. The gameplay should be like this http://www.roundgames.com/game/Go+Bang |
Author: | Raknarg [ Wed Apr 17, 2013 6:23 pm ] |
Post subject: | RE:Need help with Mouse.Where |
I think he more meant the point of that code in general |