Mouse click... procedure run
Author |
Message |
pr0xiler
|
Posted: Thu May 26, 2005 8:08 am Post subject: Mouse click... procedure run |
|
|
I need help...
I want to run a procedure when you click a certain area with the mouse within a box or oval.
Thanks. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
jamonathin
![](http://compsci.ca/v3/uploads/user_avatars/57683465145f851a43dd9a.gif)
|
Posted: Thu May 26, 2005 9:44 am Post subject: (No subject) |
|
|
Just use whatdotcolor, and make sure you're checking for the same color that's in the circle. You can do coordiantes as well, but whatdotcolor is faster, and efficient, IF there aren't many colors.
code: |
var x, y, z :int
procedure thing
put "i have gas"
end thing
drawfilloval (100,100,60,60,12)
loop
mousewhere(x,y,z)
if z = 1 and whatdotcolor(x,y)=12 then
thing
exit
end if
end loop |
|
|
|
|
|
![](images/spacer.gif) |
pr0xiler
|
Posted: Fri May 27, 2005 8:12 am Post subject: (No subject) |
|
|
Thanks... but how would I do it within coordinates, because I have over 20 red circles in my program and they all need to run different procedures. |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Fri May 27, 2005 9:06 am Post subject: (No subject) |
|
|
if the distance between mouse click and center of the circle is equal to or is less than the radius of the said circle, it was clicked. Run a forloop to check all the circles. |
|
|
|
|
![](images/spacer.gif) |
pr0xiler
|
Posted: Tue May 31, 2005 8:53 am Post subject: (No subject) |
|
|
can i please have an example in code... im clueless ![Wink Wink](images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
StarGateSG-1
![](http://img61.imageshack.us/img61/4417/jesushulk2sq.gif)
|
Posted: Tue May 31, 2005 9:28 am Post subject: (No subject) |
|
|
Why don't you just change the color of the circles, that would be the best way then you can use whatdotcolor. |
|
|
|
|
![](images/spacer.gif) |
pr0xiler
|
Posted: Thu Jun 02, 2005 10:40 am Post subject: (No subject) |
|
|
StarGateSG-1 wrote: Why don't you just change the color of the circles, that would be the best way then you can use whatdotcolor.
I have like 50 different dots, and it would look like crap all different colors. |
|
|
|
|
![](images/spacer.gif) |
|
|