Game Development Community

Using the setImageMap() function in TGB

by Josias Gibbs · in Torque Game Engine · 08/19/2008 (5:36 pm) · 4 replies

I'm trying to use the setImageMap() function to allow me to dynamically choose between several different image maps - but I"m having trouble figuring out the syntax of it. I wrote the following code, which uses the setImageMap() function in the simplest way I could think of:



new t2dImageMapDatablock(iMap01)
{
imageMode = "cell";
cellWidth = 200;
cellHeight = 150;
imageName = "./../data/images/The-Rock";
};
%this.owner.setImageMap(%iMap01, 0); //sets the sprite of the current object to frame 0 of image
//map "The-Rock"



The problem is, my code doesn't seem to DO anything. My images folder definitely contains a .png file called The-Rock. I'm new to TGB, so I wouldn't be surprised if I made some obvious syntax error - am I making any obvious errors?

#1
08/19/2008 (5:45 pm)
Try this as your imageName "game/data/images/the-rock.png"
#2
08/19/2008 (6:09 pm)
Nope - still nothing. Any other ideas?
#3
08/19/2008 (8:04 pm)
Is %iMap correct or did you mean just iMap01 without the '%'?
#4
08/20/2008 (12:11 pm)
DING! - that did it.