Passing information Classes 
	 
	
		| Author | 
		Message | 
	 
		 
		Pickles
 
  
 
    
		 | 
		
		
			
				  Posted: Sat May 22, 2004 3:59 pm    Post subject: Passing information Classes  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Ok ill try to keep this as organized and to the point as I can. 
 
 
	  | code: | 	 		      
 
%This is my Gorillas Class
 
 
proc SetPosition (x, y : int)
 
        if GorillaType = 1 then
 
            gorillaX := x
 
            gorillaY := y
 
        end if
 
    end SetPosition
 
 
 proc DrawGorillaFront
 
        if GorillaType = 1 then
 
            var MrT_Front :=
 
                Pic.FileNew ("Mr_T_Front.bmp")
 
         Pic.Draw (MrT_Front, gorillaX, gorillaY, picMerge)
 
        end if
 
    end DrawGorillaFront
 
  | 	  
 
 
In my gorillas class, there are the procedures taht set the pos of the gorilla and then draws the gorilla at those coords
 
 
 
 
 
	  | code: | 	 		  
 
%This is my Setting Module
 
 proc Buildings
 
 
 for building : 1 .. 10
 
 
 
            Draw.FillBox (x, y, x2, y2, 15)
 
 
            windows
 
 
            if building = 3 then
 
                gorilla1 -> SetType (1)
 
                gorilla1 -> SetPosition (x, y2)
 
                gorilla1 -> DrawGorillaFront
 
 
 
            end if
 
 
            if building = 8 then
 
                gorilla2 -> SetType (1)
 
                gorilla2 -> SetPosition2 (x, y2)
 
                gorilla2 -> DrawGorillaFront
 
 
            end if
 
 
        end for
 
 
    end Buildings
 
  | 	  
 
This draws the gorillas on the 2nd and 8th building (because the building heights are random i cant just draw them in my run program)
 
 
 
 
	  | code: | 	 		  
 
%this is my run program
 
 
loop
 
    Mouse.Where (mx, my, mb)
 
    locate (1, 1)
 
    put mx, "    ", my
 
    if mb = 1 then
 
        gorilla1 -> SetType (1)
 
        gorilla2 -> SetType (1)
 
 
 gorilla1 -> DrawGorillaRight
 
        gorilla2 -> DrawGorillaLeft
 
    end if
 
end loop
 
 
  | 	  
 
 
I need to be able to get the position of the two gorillas in order to draw the picture of them throwing over top of it.  But i dont have the x and y variables to pass to it because it changes every time. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		MyPistolsIn3D
 
  
 
    
		 | 
		
		
			
				  Posted: Sat May 22, 2004 4:51 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I think all you have to do is pass the x and y to the draw command.
 
 
	  | code: | 	 		  loop 
 
    Mouse.Where (mx, my, mb) 
 
    locate (1, 1) 
 
    put mx, "    ", my 
 
    if mb = 1 then 
 
        gorilla1 -> SetType (1) 
 
        gorilla2 -> SetType (1) 
 
 
        gorilla1 -> DrawGorillaRight (gorillaX,gorillaY)
 
        gorilla2 -> DrawGorillaLeft (gorillaX,gorillaY)
 
    end if 
 
end loop  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |