| Good Start, but I still need some help 
 
	 
	
		| Author | Message |   
		| RobertCoombs 
 
 
 
 
 | 
			
				|  Posted: 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:
 
 	  | Turing: |  	  | % Outline 
Draw.ThickLine (550, 100 , 600 , 200 , 10 , black) 
Draw.ThickLine (100 , 100 , 50 , 200 , 10 , black) 
Draw.ThickLine (100 , 100 , 550 , 100 , 10 , black) 
Draw.ThickLine (50 , 200 , 600 , 200 , 10 , black) 
% Top Pin Holes 
drawfilloval (115 , 175 , 10 , 10 , black) 
drawfilloval (150 , 175 , 10 , 10 , black) 
drawfilloval (185 , 175 , 10 , 10 , black) 
drawfilloval (220 , 175 , 10 , 10 , black) 
drawfilloval (255 , 175 , 10 , 10 , blue) 
drawfilloval (290 , 175 , 10 , 10 , blue) 
drawfilloval (325 , 175 , 10 , 10 , blue) 
drawfilloval (360 , 175 , 10 , 10 , blue) 
drawfilloval (395 , 175 , 10 , 10 , blue) 
drawfilloval (430 , 175 , 10 , 10 , blue) 
drawfilloval (465 , 175 , 10 , 10 , blue) 
drawfilloval (500 , 175 , 10 , 10 , blue) 
drawfilloval (535 , 175 , 10 , 10 , black) 
% Bottom Pin Holes 
drawfilloval (135 , 130 , 10 , 10 , black) 
drawfilloval (170 , 130 , 10 , 10 , black) 
drawfilloval (205 , 130 , 10 , 10 , black) 
drawfilloval (240 , 130 , 10 , 10 , black) 
drawfilloval (275 , 130 , 10 , 10 , black) 
drawfilloval (310 , 130 , 10 , 10 , black) 
drawfilloval (345 , 130 , 10 , 10 , black) 
drawfilloval (380 , 130 , 10 , 10 , black) 
drawfilloval (415 , 130 , 10 , 10 , black) 
drawfilloval (450 , 130 , 10 , 10 , black) 
drawfilloval (485 , 130 , 10 , 10 , black) 
drawfilloval (520 , 130 , 10 , 10 , black)
% Blue/Red Click Code
var  X, Y, CLICK : int 
loop
drawfilloval (255 , 175 , 10 , 10 , blue)
Mouse.Where ( X, Y, CLICK) 
if  CLICK = 1 then
drawfilloval (255 , 175 , 10 , 10 , 12) 
delay(100)
end if 
end loop | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| Dan 
 
  
 
 
 | 
			
				|  Posted: 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:
 
 
 	  | code: |  	  | 
if CLICK = 1 then
 if mouse was clicked in first circel then
 draw first circle
 else if mouse was clicked in the 2nd circle then
 draw 2nd circle
 else if  ......
 .......
 end if
 end if
 
 | 
 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.
 |  
				| Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |  |   
		|  |  |  
	  
		|  |   
		| tjmoore1993 
 
  
 
 
 | 
			
				|  Posted: 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  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |