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);
}
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);
}
Torque Owner Thomas Buscaglia