Game Development Community

Adding Objects to Coordinate Plane

by Nailah Jefferson · in Torque X 2D · 08/16/2010 (2:46 pm) · 1 replies

I would like to create a system that adds static images (by keystroke) to specific locations in the coordinate plane. For instance if we used the lower left corner of the object's bounding box as a reference, how would I add that to a 2D coordinate plane at point (X, Y)? I'm confused by some of the documentation and I was wondering if anyone could point me in the right direction. Seems like a simple problem, but I'm new to this so I'm learning as I go. Thanks!

About the author

Recent Threads


#1
08/16/2010 (5:56 pm)
You should look at the editor, and the size and location of the camera for the scene you are loading first, thats the easiest way to see where your objects will end up, if you are placing them with just code. Remember, you can move the camera, and resize it as well, to make it more user friendly.

As for placing those static images, that could be done by creating templates in the editor, and then cloning them via code after you've loaded your scene. The blaster tutorial has a good way of creating templates, and then cloning them in code, so if you go through that tutorial you would be one step closer to doing what you are talking about.

However, if you are only trying to put static images on a coordinate plane, I would not suggest using TorqueX, but rather just pure XNA. TorqueX's strong points are in its ability to create scenes with the editor, dynamic physics, effects, rendering large scenes, lighting, collisions, tools, etc.. if you don't need any of that, it might be a little bit of an overkill, and some things (like creating static sprites), would actually be more difficult.

Hope this helps.

-Will