| 
			
			Posted By
		 | 
		
			
			Message
		 | 
  	
	
	
		
  			  Zi-Xiao
  
  Registered   29/07/2002
 Points   537
 
  
  		 | 
  		
  		
  		 
  			27th July, 2011 at 02:24:22 - 
  		
			
		
  			
  		 
  			
			
			
			 
			Imagine a 2d first-person perspective game. Now, imagine two targets that are overlapping eachother in 2D but one of them is closer on the z axis. If I create a bullet object that overlaps both targets, they both get destroyed. Whats the best way of saying 'on collision, destroy the target that has the greatest/least z value'?
			
  	    
 
   
  			n/a 
  		
  		 | 
  	
  	
  	
		
  			  Aruthaz Forsaken Protector
  Registered   24/06/2011
 Points   76
  		 | 
  		
  		
  		 
  			27th July, 2011 at 06:20:48 -
  		
			
		
  			
  		  
  			
				Im confused about what a 2-d first person game would look like :/ You could try testing in the bullet collision what is closer on the z axis and only hit that one, then destroy itself. No clue if that would work though, as don't exactly understand the problem...
			
  	    
 
   
  			-----------------------------------------
 
Death is the only cure for madness such as his, even that solace escapes him.
 
iOS App -> http://itunes.apple.com/us/app/jimmy-dungeon-escape!/id467193691?ls=1&mt=8 
  		
  		 | 
  	
  	
  	
  	
  	
		
  			  Assault Andy Administrator 
I make other people create vaporware
  Registered   29/07/2002
 Points   5661
 
       
  		 | 
  		
  		
  		 
  			27th July, 2011 at 06:36:15 -
  		
			
		
  			
  		  
  			
				Select Object Extension > New condition > Select by display order > Select foremost/rearmost object
 
 
Throw that in with the rest of your conditions.
			
  	    
 
   
  			Creator of Faerie Solitaire:
 
http://www.create-games.com/download.asp?id=7792 
 
Also creator of ZDay20 and Dungeon Dash.
 
http://www.Jigxor.com 
 
http://twitter.com/JigxorAndy 
  		
  		 | 
  	
  	
  	
  	
  	
		
  			  Zi-Xiao
  
  Registered   29/07/2002
 Points   537
 
  
  		 | 
  		
  		
  		 
  			29th July, 2011 at 20:22:51 -
  		
			
		
  			
  		  
  			
				To simplify the problem,
 
 
Lets say that when a bullet object overlaps more than one object (lets say 3), I want to destroy the one with the Highest y value (closes to the bottom of the screen).
 
 
Andy,
 
 
If at all possible I'd like to accomplish this without extensions and without extensive looping. Currently I'm using a fastloop to go from the bottom of the screen to the top and the first object that I come across that is overlapping the bullet gets destroyed.... But that is a HEAVY loop to run every cycle.
			
  	    
 
   
  			n/a 
  		
  		 | 
  	
  	
  	
  	
  	
		
  			  Assault Andy Administrator 
I make other people create vaporware
  Registered   29/07/2002
 Points   5661
 
       
  		 | 
  		
  		
  		 
  			30th July, 2011 at 06:57:42 -
  		
			
		
  			
  		  
  			
				There are a couple of work arounds for not using an extension, but they're painful to implement. What is your reason for not wanting to use extensions?
			
  	    
 
   
  			Creator of Faerie Solitaire:
 
http://www.create-games.com/download.asp?id=7792 
 
Also creator of ZDay20 and Dungeon Dash.
 
http://www.Jigxor.com 
 
http://twitter.com/JigxorAndy 
  		
  		 | 
  	
  	
  	
		
			| 
				 
			 | 
	    		
				  
	    		 |