View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:19 am



Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
 Scene height? 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Scene height?
SceneMan.SceneHeight


Fri Apr 22, 2011 3:52 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Scene height?
The top of the map is Y-position 0.


Fri Apr 22, 2011 3:59 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Scene height?
Aahhh.

And at which position do crafts go back to TradeStar?


Fri Apr 22, 2011 4:40 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Scene height?
About 50 pixels above 0. Not exactly sure the precise position.


Fri Apr 22, 2011 4:45 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 20 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.053s | 13 Queries | GZIP : Off ]