Game Development Community

Dynamic sprite deformation

by Dennis Harrington · in Torque Game Builder · 06/12/2006 (11:43 am) · 8 replies

Is there any way to do sprite deformation in TGB without engine modifications? I'm guessing not but just wanted to double-check.

I know I can simulate it by having different states and animations for the object I want to destroy and/or deform but I was hoping for something a bit more random and realistic. I guess you'd have to access the functions that are actually doing the rendering on screen, correct? To the best of my knowledge there is no way to do this in TGB, stock.

Any feedback would be appreciated!

#1
06/12/2006 (2:38 pm)
What kind of deformation do you mean exactly?
#2
06/12/2006 (2:49 pm)
Yeah, not exactly positive what you would like, but keeping the width of the sprite constant and changing it's height (smaller or larger), for example, would "deform" it. This could be done in torquescript easily, no need for engine mods.
#3
06/12/2006 (3:16 pm)
Sorry, I should've been clearer.

Here's an example: Say you have a huge asteroid that acts as an obstacle in a top-down game. The player controls a ship that can fire lasers at it but I don't want one shot to blow it up. I'd like to have the asteroid get "eaten" away where the laser hits it. So it may take 9 or 10 shots to completely destroy it. Or the player could destroy just enough of it to carve a path through it and just avoid the remaining fragment(s).

Does that make more sense?

That's why I was thinking that a workaround would be to create "breakable" zones on each asteroid and then trigger an animation followed by a new frame or sprite. But I'd ideally like to be able to destroy and deform the sprite totally dynamically. That's why it seemed to me that you'd have to get involved in the actual rendering engine.

If this still isn't clear. I'll post a Photoshop mockup of it tonight.
#4
06/12/2006 (3:20 pm)
Well, you could use a tile layer for this sort of destrucable objects. That would give you quite some flexibility.
#5
06/12/2006 (4:45 pm)
Really? Tile layers? I just looked at the list of tile layer methods and I couldn't see anything that would facilitate doing this. Unless your idea is a bit more abstract. Are you talking about having multiple tile layers with varying states of the object's decay or something else?
#6
06/12/2006 (10:55 pm)
Say your asteroid is a small tilemap (5x5). Now, when the shot hits, you can change the tile that was hit and those tiles around it.

This will also allow you to check easily if the player shot all the way through the asteroid (in which case you could copy the two halves to two new tile maps and make thos drift away, for example).
#7
06/13/2006 (12:17 am)
Yes, I imagine it too like Lennart says it.
#8
06/13/2006 (12:28 am)
Ah, I see! That's a really good idea. For some reason the thought never occured to me to use small tilemaps to represent objects.

Thanks a lot for the help guys. I really appreciate it.