Game Development Community

Dynamic creation of image map

by Nir Ziso · in Torque Game Builder · 07/16/2006 (4:28 am) · 4 replies

Dynamic creation of image map

I am trying to build some cars from image map
I build a controller object to do this dynamic action the cards are draw on the screen
But when I'm trying to put any event on them the cards not accept this event
Here is my code:


function controler::onLevelLoaded(%this, %scenegraph)
{
for(%i=0;%i<8;%i++)
{
%myobject= new t2dStaticSprite()
{ scenegraph = %this.scenegraph; };

%myobject.imageMap = "cardsImageMap2";
%myobject.frame = %i;
%myobject.class = "cards";
%myobject.setPositionX(%i*5);
%myobject.setPositiony(20);
echo(%myobject.position);
echo(%myobject.class);
%myobject.size = "6.75 8.75";
}

}

function cards::onMouseDown(%this,%modifier,%worldPosition,%mouseClicks)
{

echo("do some action");
// echo(%this.frame);
}

#1
07/16/2006 (6:46 pm)
Did you enable mouse events on those objects? Check out this tutorial.
#3
07/18/2006 (1:40 pm)
I set them but they do not work
#4
07/27/2006 (12:30 am)
Its work!!!
thanks a lot to vance for his kindly help
http://www.garagegames.com/mg/forums/result.thread.php?qt=47950