Game Development Community

Swapping Tiles

by Juan Maldonado · in Torque Game Builder · 06/29/2010 (7:36 pm) · 2 replies

I have a question about swapping images.
I was using the match-3 tutorial as a basis for my own match-3 game and was curious if there is a way to swap a static sprite with another sprite on mouseDown?
For example if I had numbered tiles 1 and 2, I would want "1" to swap to "2" and vice versa on mouseDown, but to play an animated sprite during the transition. Is that even possible or would it just be able to swap a static sprite for a static sprite? This all occurs within a tile layer. Any suggestions would be appreciated, thank you in advance.

About the author

Recent Threads


#1
06/29/2010 (7:56 pm)
You can easily swap imageMaps:

function swapImage(%sprite1, %sprite2)
{
   %tmp=%sprite1.imageMap;
   %sprite1.imageMap=%sprite2.imageMap;
   %sprite2.imageMap=%tmp;
}
#2
06/29/2010 (8:38 pm)
Thank you, your help is very much appreciated.