| Author | 
            Message | 
        
        
			| 
				
				 Asklar 
				Data Realms Elite 
				
					 Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
				 
				 
			 | 
			
				
				  Scene height?  
					
						I want to spawn an emitter that fires lasers. The thing is that I want to spawn the pinned emitter from the very top of the map, so is there any function to get the height of the map? 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 3:51 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						SceneMan.SceneHeight 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 3:52 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 CaveCricket48 
				
				
					 Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						The top of the map is Y-position 0. 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 3:59 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Asklar 
				Data Realms Elite 
				
					 Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						Would this work for the position part?
  HeightVar = SceneMan.SceneHeight self.Pos + Vector((i-30),HeightVar) 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:04 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 CaveCricket48 
				
				
					 Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						Code: self.Pos + Vector((i-30),0) SceneMan.SceneHeight gets you the height of the map, but the 'zero' position starts at the top, and the Y-axis is upside-down (positive numbers down, negative above). Meaning, if you set the Y-position to be the scene's height, that would be the  bottom of the map, not the top.  
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:10 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Asklar 
				Data Realms Elite 
				
					 Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						If I put self.Pos + Vector((i-30),0), would that change the Y position? 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:18 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 CaveCricket48 
				
				
					 Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						Vector((i-30),0) would have it at the scene's top. Having self.Pos added would have the y-axis the same as wherever "self" is on the y-axis. 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:23 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Asklar 
				Data Realms Elite 
				
					 Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						In this case I use (i-30) as the x position because I spawn a lot of emitters very near with a for loop to reduce the amount of stuff written into the lua. If instead I do Code: Laser.Pos.X = self.Pos.X + (i-30) Laser.Pos.Y = 0
  , would that work?  
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:28 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						If you giving it a position relative to another position, shouldn't you constantly just give it a Y value of 0?
  Damnit, you beat me to it. 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:30 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 CaveCricket48 
				
				
					 Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						Quote: Vector(self.Pos.X + (i-30),0) Yah, pretty much. No need for extra variables though.  
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:31 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Asklar 
				Data Realms Elite 
				
					 Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						I'm still learning   Question. The top of the map is higher than the visible top of the map?  If it is, by how much aprox.?  
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:37 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 CaveCricket48 
				
				
					 Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						Y-position 0 should be visible, and would be the top-most pixel you can see. 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:39 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Asklar 
				Data Realms Elite 
				
					 Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						Aahhh.
  And at which position do crafts go back to TradeStar? 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:40 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 CaveCricket48 
				
				
					 Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						About 50 pixels above 0. Not exactly sure the precise position. 
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:45 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Asklar 
				Data Realms Elite 
				
					 Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
				 
				 
			 | 
			
				
				  Re: Scene height?  
					
						This is odd.  For some reason, I don't know where the emitters are spawning. I know they are being spawned, I can hear their emission's sound, but I don't know where they are. Code: function Create(self) -- placed this before to check if the particle was spawning. Lol    x = math.random(200)    if x > 1 then       print(x)    end end function Update(self)
   for i = 1,60 do    Laser = CreateAEmitter("Beam")    Laser.Pos = Vector(self.Pos.X + (i-30),0)    MovableMan:AddParticle(Laser)  end end This is my code so far, and my guess is that there isn't any problem at all. What could it be?  
					
  
			 | 
		
		
			| Fri Apr 22, 2011 4:54 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
	
		 |