Game Development Community

Dynamic creation of objects

by Vance Souders · in Torque Game Builder · 07/25/2006 (1:06 pm) · 0 replies

I'd like to dynamically create static sprites and add them to the scene graph without placing anything in the level editor. I've tried a few different things and haven't been able to get the sprite to appear.

I'm creating a datablock like this:

datablock t2dSceneObjectDatablock(gamePieceDatablock)
{    
	size = "32 32";    
	position = "100 100";
	imageMap = "NumbersImageMap";
	frame = "1";
	layer = "0";
};

and creating a sprite like this:

$sprite = new t2dStaticSprite()
{
	sceneGraph = SceneGraph;	
	config = "gamePieceDatablock";
};

I've got a few related questions:

-Can I dump the current scenegraph to the console?

-Is there a best practice for where to place the start of the game logic?

Any help would be much appreciated....



[EDIT] - found my mistake..... wrong layer....

-Vance