| Author | 
		Message | 
	
		 
		PesticideUse
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Aug 21, 2008 7:06 pm    Post subject: Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Hey, I've searched a bit for a good tutorial  on how to make buttons but haven't really found one.
 
 
it was recently suggested that i add buttons to my games and i believe that's a good suggestion.
 
 
i can use mousewhere, but don't want to have to check that "mx" and "my" are inside a box of coordinates around the button every time i click, for my games that could take a lot of time to put in... whatdotcolor could be used with mx and my but again that could take a bit of work, i would like a simple way to add the button into my game.
 
 
if anyone can suggest a good tutorial or help me out thank you   | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	
	 
		  | 
	
				 
		michaelp
 
  
 
    
		 | 
		
		 | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		PesticideUse
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Aug 21, 2008 7:52 pm    Post subject: Re: Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Thanks   , didnt use the GUI thing cuz im totally clueless when it comes to that lol but i went the the walkthrough and found some stuff | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		michaelp
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Aug 21, 2008 8:25 pm    Post subject: RE:Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Just remember to Search next time.
 
And I didn't even make that Turing Walkthrough thing a link, that's sweet!   | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		PesticideUse
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Aug 21, 2008 9:43 pm    Post subject: Re: Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| i did search, but not in the tutorial part... duh lol | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		SNIPERDUDE
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Aug 21, 2008 10:24 pm    Post subject: RE:Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Yea.  The Turing GUI really isn't that good, but it is a good simple start.  Check out my package I made for custom buttons, you might like it.
 
 
http://compsci.ca/v3/viewtopic.php?p=167643#167643
 
 
And yes, anytime you mention the Turing Walkthrough it will auto link it for you!   | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		PesticideUse
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Aug 21, 2008 10:30 pm    Post subject: Re: Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Very cool, probably wont put that in anything im working on now, but maybe one of my future projects   | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		SNIPERDUDE
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Aug 21, 2008 10:45 pm    Post subject: RE:Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				No prob.   
 
Just remember to give the proper credit... | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	
	 
		  | 
	
				 
		Insectoid
 
  
 
    
		 | 
		
		
			
				  Posted: Fri Aug 22, 2008 10:28 am    Post subject: RE:Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				If all your buttons have the same X values, then you can check once for the X and then check what the mouse's Y value is. 
 
 
	  | code: | 	 		  
 
if mousex > X1 and mousex < X2 and button = 1 then
 
    if mousey > button1y1 and mousey < button1y2 then
 
        %do some stuff
 
    elsif mousey > button2y1 and mousey < button2y2 then
 
        %do other stuff
 
    end if
 
end if
 
  | 	  
 
 
This way you save a lot of code (I once had 12 or so buttons in a column, I saved a lot of time & space this way). | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		PesticideUse
 
  
 
    
		 | 
		
		
			
				  Posted: Sat Aug 23, 2008 7:38 pm    Post subject: Re: Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				will do sniperdude    
 
and thank you for the pointer insectoid i didnt think of that   | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		SNIPERDUDE
 
  
 
    
		 | 
		
		
			
				  Posted: Sat Aug 23, 2008 7:49 pm    Post subject: RE:Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| If you want to compact Insectoid's code; if all of your buttons are equally spaced you can use a for loop to check the coordinates. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		CodeMonkey2000
 
 
 
    
		 | 
		
		
			
				  Posted: Sun Aug 24, 2008 12:25 pm    Post subject: RE:Help Making Buttons  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Surprised that no one linked to this.
 
 
That's a solid introduction to classes, and object oriented programming. You probably should read all three parts, but the intro has a custom made button class. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		 |