Game Development Community

How to make n images to one

by Dirk Bach · in Torque X 2D · 05/28/2009 (2:12 pm) · 4 replies

Hello
Im brand new to Torque 2D, but it looks very interesting. After reviewing the function reference Im still not sure if I can the blit several images into one at game runtime.
Example: I have a tile/image that looks like a white dice without any (black) dots on it. I would like now to "blit" dots (another tile/image) onto the dice tile at a certain position and this at runtime, thats it. As long as the dice tile (now with dots on it) in the game exists, I wont remove the dots or doing further blit operations.
Is there such an operation in Torque 2D engine (TGB) operation? If so, could you please tell me the name of this function?

Thank you
Dirk

About the author

Recent Threads


#1
05/28/2009 (3:06 pm)
There isn't anything built-into Torque X to do this. But, it may not be that hard to do, thanks to the flexible .NET framework. To take a look at the System.Drawing.Bitmap class for loading/creating/saving images. After you create your image, you need to create a new material and then apply that material to your sprite.

But -

Based on your question. I need to ask if this is what you really want. You used the word 'dice' which only has six sides. Can't you just create all six variaitions of the dice in different sprite templates (or at least different materials) and then apply those materials dynamically? It would be a whole lot easier.

I don't know anything about your game, but if you can be very specific about your needs, there might be an easier solution.


John K.
www.envygames.com
#2
05/28/2009 (3:12 pm)
Hi John
First of all big thanks for your answer. Since I'm working on Mac, I only can smile about .Net (ok, we have Mono now).
Concerning your question: I used a simple example. In fact I want to blit different symbols in different constellation. To get all those constellations I would need to pre-create thousands of sprites, what is not doable.
Im quite surprised (dissapointed) that such "simple" operations are not supported in Torque 2D, did it many times and very easy in Pygame. Im sure it could be used in many ways (card games with different images, attributes, etc.).

Thanks
Dirk
#3
05/30/2009 (3:48 am)
If that is not possible I was thinking of grouping ojbects, so I can move them at the same time, if needed - so they look as "1 object", what I cant find either. :(

I'll check out some other 2D/3D engines then.

Thanks
#4
05/31/2009 (8:32 pm)
Dirk, Sorry for the late response. I see what you mean. There's a couple ways of doing this. The easiest solution that Torque X offers is the concept of mounting. A static or animated sprite can mount to another (you can do this in the 2D designer) or in code. Then, as one sprite moves around any mounted sprite will move and/or rotate along with it. At first, I thought you were literally talking about merging multiple images into a single composite image, which is also possible, just a lot harder.

John K.
www.envygames.com