Game Development Community

SetSize Takes Different Values Than Actual Image?

by Jay Jennings · in Torque Game Builder · 10/29/2009 (11:20 pm) · 4 replies

I imported a new image map into my project and the graphic is about 150 x 100. I used this code:

%this.setSize("75 50");

...to try and make the graphic about half the size of the original. Instead, I got a graphic that was huge. To get the smaller size I ended up doing:

%this.setSize("8 4");

I don't get how those numbers map to the size I want. Are sizes and stuff in TorqueScript on a different scale than real life?

Thanks.

Jay Jennings

About the author

Make my living writing and selling ecommerce tools -- but I'd rather be writing games (of course). My family of four lives in 208 square feet and we may be in YOUR town next week.


#1
10/30/2009 (5:59 am)
If you click on "Project", select the t2dSceneGraph, click on "Edit", you can change the Camera's width and height to be equal to your design resolution.

I typically put both at 1024x768, but that's up to you.
#2
10/30/2009 (2:05 pm)
Ah-ha! Okay, my scene was set to 1024x768 but the camera was set to 100x75, which would have mapped everything down by 10 times or so.

No wonder things seemed weird.

Of course, now I get to go back through my code and redo all my world limit numbers, etc. (Oh, the folly of hardcoding values!)

Or, now that I know *why* it's happening, maybe for this sample program I'll just leave the dimensions remapped. =:)

Thanks for the solution, William.

Jay Jennings
#3
10/30/2009 (2:15 pm)
Hmmm, so what would be a good reason for having your design resolution and camera width and height to be different? If you just wanted to look "through a window" at the background?

But if that were the case, I still wouldn't expect the values such as graphic size to remap.

Unless, are all those things like setSize() based on the camera view and not the design resolution? If so, then (to me) it doesn't sound like the camera is a "window" to the scene below, it sounds like the camera is an active participant in what's going on.

I may be making things more complicated than it really is, but I'm ust trying to wrap my head around these concepts so I don't code myself into a corner.

Jay Jennings
#4
10/30/2009 (3:13 pm)
I've yet to find a reason to have them different.

Now, I do change the extents once the game is going to simulate animation (like a whole scene zooming in). But while I'm making the game, I make the camera and the design resolution the same.