A few more questions
by Chris "Hyena" Vogel · in Torque Game Builder · 03/29/2005 (4:25 pm) · 8 replies
Ok! I've been working with T2D for a few days now, and I have some more questions =)
1) Is there an easy way to display an image on the screen with coords relative to the camera instead of world coords? For example, what if I always wanted something showing in the top-left or wanted a menu to pop up in the middle-right. I know I could do this with the GUI system, but can I do this with sprites as well?
2) What's the relation between the actual size of an image, and the size of tiles on the tilemap, and the size of tiles set with SetTileSize(); I'm having trouble getting all that straightened out. For example...
My tiles are 32x32 pixels in the image file that I read in. When I setup the Datablock, I tell it to use 32 and 32 for the Cell width/height. However, when I create an fxTilemap2D object and set it to those graphics, if I SetTileSize("32 32"); they are WAAAY too big. Currently I'm using SetTileSize("8 8"); to get a decent size. I assume this may be due to the way my camera is setup, but i'm not sure how to fix it. Can someone give me some detail on this?
1) Is there an easy way to display an image on the screen with coords relative to the camera instead of world coords? For example, what if I always wanted something showing in the top-left or wanted a menu to pop up in the middle-right. I know I could do this with the GUI system, but can I do this with sprites as well?
2) What's the relation between the actual size of an image, and the size of tiles on the tilemap, and the size of tiles set with SetTileSize(); I'm having trouble getting all that straightened out. For example...
My tiles are 32x32 pixels in the image file that I read in. When I setup the Datablock, I tell it to use 32 and 32 for the Cell width/height. However, when I create an fxTilemap2D object and set it to those graphics, if I SetTileSize("32 32"); they are WAAAY too big. Currently I'm using SetTileSize("8 8"); to get a decent size. I assume this may be due to the way my camera is setup, but i'm not sure how to fix it. Can someone give me some detail on this?
#2
03/29/2005 (4:33 pm)
So SetTileSize() is taking World Units as parameters? So I'm telling it to make each tile 8 world-units in width and height?
#3
03/29/2005 (4:36 pm)
Yup. That you are.
#5
getCurrent CameraArea(x/y/width/height)
EDIT:
You know of getWord( string, offset ) to retrieve values from a string?
03/29/2005 (4:38 pm)
Ah, I had to look it up. See my first post. I edited it and included what may help you:getCurrent CameraArea(x/y/width/height)
EDIT:
You know of getWord( string, offset ) to retrieve values from a string?
#6
new fxSceneGraph2D(hudSceneGraph);
Then attach any sprites to that sceneGraph, you'll need a second sceneWindow to display that location as well.
Not sure if that's the best way of doing things, but it's working for me.
03/29/2005 (4:41 pm)
You can maintain a second scenegraph object to keep everything locked to the camera.new fxSceneGraph2D(hudSceneGraph);
Then attach any sprites to that sceneGraph, you'll need a second sceneWindow to display that location as well.
Not sure if that's the best way of doing things, but it's working for me.
#7
Ooh. So a scene that overlays the game scene for things like an in-game interface. Very spiffy. That's the way to go.
03/29/2005 (4:46 pm)
@ Joeseph:Ooh. So a scene that overlays the game scene for things like an in-game interface. Very spiffy. That's the way to go.
#8
@Joseph - That sounds like a great way to do it. I'll give it a try.
03/29/2005 (4:49 pm)
@Matt - Thanks for the help!@Joseph - That sounds like a great way to do it. I'll give it a try.
Torque Owner Matt Van Gorkom
As far as your tile size, it's based on world coords not pixels.