Computer Science Canada Mouse Question |
Author: | MichaelM [ Sun Aug 05, 2007 11:10 am ] | ||
Post subject: | Mouse Question | ||
Im making a game where you click of boxes that do things depending on their colours etc... However im not sure what I should be using for the mouse. I tried Mouse.Where but I dont know the parameters, any help?!? --edit-- okay, no answer yet, but i tried out the Mouse.Where and experimented with whatdotcolour. test it out, for now it just puts out 12 random boxes, blue or orange. to test the mouse, it'll say if the box is blue or orange, but shouldn't it only check when the mouse has been clicked? Also, is there a way to prevent the error of "oustside clipping range" ? Another question, i put GUI stuff at the start and end, is that necessary for Mouse.Where? heres the code...
|
Author: | Aziz [ Mon Aug 06, 2007 10:13 am ] | ||||
Post subject: | RE:Mouse Question | ||||
First off, no you don't need the GUI module. You don't use anything from the GUI module (GUI.something). Second, check out some of these tutorials: http://www.compsci.ca/v2/viewtopic.php?t=3275 http://www.compsci.ca/v2/viewtopic.php?t=6 This code is correct:
That is a simple loop. You could replace the whatdotcolour check with check to the boundaries of the box. Say the box is at (10,10) to (30, 30). The check would be:
|
Author: | Clayton [ Mon Aug 06, 2007 7:18 pm ] |
Post subject: | RE:Mouse Question |
Except, we won't be hardcoding those values in now will we? ![]() |
Author: | Aziz [ Tue Aug 07, 2007 9:59 am ] |
Post subject: | RE:Mouse Question |
Let me quote that Hyundai commercial: Hyundai commerical wrote: Duh!
Yes, the correct way to do this would to be have the box coordinates as variables. Or even better, make a 'box' type as a record that holds x1,y1,x2,y2. Cheers, and good luck! |
Author: | MichaelM [ Tue Aug 07, 2007 5:36 pm ] |
Post subject: | Re: Mouse Question |
thanks guys ![]() |