Computer Science Canada Good Start, but I still need some help |
Author: | RobertCoombs [ Fri May 15, 2009 4:03 pm ] | ||
Post subject: | Good Start, but I still need some help | ||
I would lke to thank the two people who helped me on my last post, it's a great start, however I need the code to function so that when I click on the specific button or hole it will be the only one turning red and I need it to stay red until I click a second time. Any help once again would be aprreciated. Thanks in advance, RobertCoombs Here is the updated code:
|
Author: | Dan [ Fri May 15, 2009 4:54 pm ] | ||
Post subject: | RE:Good Start, but I still need some help | ||
Well you are going to need some colesion detection to see if the mouse was clicked on the cricle. See: http://compsci.ca/v3/viewtopic.php?t=13661 The code would look somting like:
Note that the above is pesdocode. Then to make it stay red you just don't draw over it at the top of the loop like you are now. You will likey want to set up some varaibles to track the state of each circle and to determnin if the should be drawn as red or set back to blue (to set it back just draw over it with a blue circle). To make things cleaner you could make a function that takes X, Y from the mouse and retruns what circle it is on and a function that draws a circle give some id and the color, but that just makes the code look nicer. |
Author: | tjmoore1993 [ Fri May 15, 2009 5:25 pm ] |
Post subject: | RE:Good Start, but I still need some help |
I am not sure which would suit your needs but I am pretty sure you can use Whatdot to do collision or you can find that guide on perfect circles collision ![]() |