| Author | 
            Message | 
        
        
			| 
				
				 numgun 
				
				
					 Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
				 
				 
			 | 
			
				
				  Checking position beyond scene borders?  
					
						How can I check if an object it past the scene's border? I have this thing that is supposed to spawn an actor when destroyed, but if it gets destroyed by going over the border and dying from that, it will crash the game instantly. I'm thinking a simple function making the appearing actor to move just to the border and getting destroyed like it normally would might fix the problem. Not sure though.
  Can I use something like?:
  if self.pos < SceneMaxHeight then  self.Pos = SceneMaxHeight; end 
					
  
			 | 
		
		
			| Mon Sep 07, 2009 8:54 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Kyred 
				
				
					 Joined: Sun May 31, 2009 1:04 am Posts: 308
				 
				 
			 | 
			
				
				  Re: Checking position beyond scene borders?  
					
						Position (0,0) is the top left corner of the scene.  If the y-value is negative, then the object should will be above the scene.
 
 Don't really know if y values drop below zero or not.  Haven't really tried it. Just tested it.  It works =). 
					
  
			 | 
		
		
			| Mon Sep 07, 2009 9:03 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 numgun 
				
				
					 Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
				 
				 
			 | 
			
				
				  Re: Checking position beyond scene borders?  
					
						No not the top border, the bottom one. And possibly the side borders on non-XWrap maps.
  I'm asking is there a way to get the value with a statement that would work for every map instead of just one. 
					
  
			 | 
		
		
			| Mon Sep 07, 2009 9:15 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 TheLastBanana 
				DRL Developer 
				
					 Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
				 
				 
			 | 
			
				
				  Re: Checking position beyond scene borders?  
					
						SceneMan.Scene.Width or SceneMan.Scene.Height should do the trick. 
					
  
			 | 
		
		
			| Mon Sep 07, 2009 9:19 pm | 
			
				
					 
					
					 
				    
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: Checking position beyond scene borders?  
					
						SceneMan.SceneHeight and SceneMan.SceneWidth actually.
  Just use if self.Pos.X > SceneMan.SceneWidth then
  and height/y for past the bottom edge. 
					
  
			 | 
		
		
			| Mon Sep 07, 2009 10:21 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 TheLastBanana 
				DRL Developer 
				
					 Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
				 
				 
			 | 
			
				
				  Re: Checking position beyond scene borders?  
					
						Actually both of them work >:[ But yes, if you want to leave out a SINGLE DOT then you go right on ahead. 
					
  
			 | 
		
		
			| Mon Sep 07, 2009 10:32 pm | 
			
				
					 
					
					 
				    
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: Checking position beyond scene borders?  
					
						CODE CONCATENATION IS AN IMPORTANT PART OF THE LEARNING PROCESS 
					
  
			 | 
		
		
			| Mon Sep 07, 2009 10:40 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
	
		 |