Data Realms Fan Forums http://45.55.195.193/ |
|
Scene height? http://45.55.195.193/viewtopic.php?f=73&t=23128 |
Page 1 of 2 |
Author: | Asklar [ Fri Apr 22, 2011 3:51 am ] |
Post subject: | 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? |
Author: | Grif [ Fri Apr 22, 2011 3:52 am ] |
Post subject: | Re: Scene height? |
SceneMan.SceneHeight |
Author: | CaveCricket48 [ Fri Apr 22, 2011 3:59 am ] |
Post subject: | Re: Scene height? |
The top of the map is Y-position 0. |
Author: | Asklar [ Fri Apr 22, 2011 4:04 am ] |
Post subject: | Re: Scene height? |
Would this work for the position part? HeightVar = SceneMan.SceneHeight self.Pos + Vector((i-30),HeightVar) |
Author: | CaveCricket48 [ Fri Apr 22, 2011 4:10 am ] |
Post subject: | 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. |
Author: | Asklar [ Fri Apr 22, 2011 4:18 am ] |
Post subject: | Re: Scene height? |
If I put self.Pos + Vector((i-30),0), would that change the Y position? |
Author: | CaveCricket48 [ Fri Apr 22, 2011 4:23 am ] |
Post subject: | 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. |
Author: | Asklar [ Fri Apr 22, 2011 4:28 am ] |
Post subject: | 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? |
Author: | Coops [ Fri Apr 22, 2011 4:30 am ] |
Post subject: | Re: Scene height? |
Damnit, you beat me to it. |
Author: | CaveCricket48 [ Fri Apr 22, 2011 4:31 am ] |
Post subject: | Re: Scene height? |
Quote: Vector(self.Pos.X + (i-30),0) Yah, pretty much. No need for extra variables though. |
Author: | Asklar [ Fri Apr 22, 2011 4:37 am ] |
Post subject: | 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.? |
Author: | CaveCricket48 [ Fri Apr 22, 2011 4:39 am ] |
Post subject: | Re: Scene height? |
Y-position 0 should be visible, and would be the top-most pixel you can see. |
Author: | Asklar [ Fri Apr 22, 2011 4:40 am ] |
Post subject: | Re: Scene height? |
Aahhh. And at which position do crafts go back to TradeStar? |
Author: | CaveCricket48 [ Fri Apr 22, 2011 4:45 am ] |
Post subject: | Re: Scene height? |
About 50 pixels above 0. Not exactly sure the precise position. |
Author: | Asklar [ Fri Apr 22, 2011 4:54 am ] |
Post subject: | 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? |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |