Game Development Community

Center

by PeterB · in Torque Game Builder · 01/21/2006 (12:21 pm) · 4 replies

Using a freshly installed copy of T2D 1.0.2, I spawn a sprite at (0,0). But it doesn't look centered.

If I change the camera position to (-13,-7) :

sceneWindow2D.setCurrentCameraPosition( "-13 -7 100 75" );

.....then it looks about right. I guess I'm surprised that it's almost centered, but not quite. Why do I have to make this adjustment to have the camera centered on the center of the world?

-ty

#1
01/21/2006 (12:32 pm)
Instead of using 100 75 for your camera size you might want to set it to whatever resolution you'd like to make your game in, for example ("0 0 640 480") or "0 0 800 600", it will help with positioning sprites (imo at least)..
although I'm not sure why the sprite isn't appearing centered, is it appearing to the lower right of where the center is?
#2
01/21/2006 (12:39 pm)
Sorry. I must of done something silly. I said I had a clean build, but I have actually been working for a couple of hours. Just now I really did try centering a sprite from clean build and it looks great. All I did was add a simple gui, so it's strange. Sorry for crying wolf, I'll go through my code again. Thanks.

And I like your advise about the size of the camera....
#3
01/21/2006 (12:43 pm)
Ok, while making my gui, apparently I had accidentally grabbed the main window and dragged it a bit. Since it's essentially invisible, I didn't notice. Will watch out for that in the future.
#4
03/24/2009 (8:58 am)
I had the same problem.. Turns out Had my container at 800x600, and my scenewindow underneath the container at 1024 768. The problem was that the whole thing was off-centered for months!
Thanks for the help gang!

-nic