Game Development Community

Generate image after scene loads...

by amaranthia · in Torque Game Builder · 02/29/2008 (3:24 pm) · 2 replies

I've done this before, but for some reason, I can't seem to get this to work...

I want to display and image and I want to do this through script. But the darn image refuses to appear.

Do you see something wrong with the following code? I don't want to assign datablocks or anything to the image. At the moment, I just want it to show up.

managed\datablocks.cs:

new t2dImageMapDatablock(BlenderImageMap) {
      imageName = "~/data/images/items-blender1.png";
      imageMode = "FULL";
   };

gameScripts\scene.cs:

function Scene::onLevelLoaded(%this)
{
     new t2dStaticSprite() {
         imageMap = "BlenderImageMap";
         position = "22.751 8.875";
         size = "11.000 12.250";         
      };            
}

#1
02/29/2008 (3:35 pm)
Er, I got it to show up right after I posted this!

I hadn't declared my scenegraph. :-)

%test = new t2dStaticSprite() {
         sceneGraph = %this;
         imageMap = "BlenderImageMap";
         position = "22.751 8.875";
         size = "11.000 12.250";
      };
#2
02/29/2008 (4:56 pm)
Quote:I hadn't declared my scenegraph.

I always do that at least 3 times after I haven't worked with TGB for a while.