Game Development Community

Cordinates Using X & Y Position

by Andrew Taylor · in Torque Game Builder · 07/30/2006 (7:52 am) · 5 replies

Is there any way to get this to use the X & Y as actual pixels instead of center position?

I have set my camera to 800x600, but I still have to set positions by -100x22 etc. This is very difficult, especially with objects that change size during their lifetime.

Any ideas?

Thanks!

#1
07/30/2006 (8:28 am)
How about using the Camera Tool to move the visible area into a quadrant that has (0, 0) in one of the corners, and also play with Edit, Preferences, Resolution and Edit, Preferences, Level Editor, Grid Size & Design Resolution, etc. to get what you're asking for... ?
#2
07/30/2006 (8:48 am)
Hey Jason,

My camera is already at 0,0. Which ould make me think that if the camera is at 0,0 and 800,600 then I could set something at 400,300 if I wanted the top left corner to be in the middle. But it's not working that way. :( Oh well, guess I will find a way to code around it.
#3
07/31/2006 (3:27 pm)
The position of the camera is the center of the window. Positions work in world coordinates, not pixels, which is probably why you're having problems getting things to line up based on the window resolution. Maybe if you tell us what youre trying to do we can help you find a solution.
#4
07/31/2006 (4:06 pm)
Thomas,

I think I can just do it programatically, but basically what I have is a sprite that represents a health bar type deal. I was planning to make it expand in width to show more health available, and contract to show less. But I believe I can position it based on knowing the width, and then calculating the propery position.
#5
07/31/2006 (8:24 pm)
I see two ways, both could be kind of a pain.

1) go to EDIT- PREFENCES & show the origin. This points to 0,0. So you could move the entire game area to fit with a corner of the project at 0,0.

2) use scripts & the camera view size to determine where the life bar would go. So if the bar is always susposed to be centered horizontally & 1/6th from the top of the screen verticly you would need to set the x,y to x = camera_X_position & y = (camera_Y_position + (camera_Height / 2) ) - (camera_Height / 6)

obiviously that's not the exact script but it's a start. I'm assuming the camera X,Y is it's center. i think that should give you what you want.