Need help with Mouse.Where
Author |
Message |
Dittatore
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Nathan4102
|
Posted: Thu Apr 11, 2013 5:17 pm Post subject: RE:Need help with Mouse.Where |
|
|
CODE: | for i : 1..225
%insert code here
end for |
This would repeat the code inbetween the for's 225 times. Is this what you're looking for? |
|
|
|
|
![](images/spacer.gif) |
Panphobia
![](http://compsci.ca/v3/uploads/user_avatars/62033050050c6b61548706.png)
|
Posted: 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 Turing: | loop
exit when (condition for breaking loop)
end loop |
|
|
|
|
|
![](images/spacer.gif) |
Dittatore
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: 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 ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
Dittatore
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
|
|