Sprite problems
by John Coyne · in Torque Game Builder · 02/23/2006 (3:47 am) · 2 replies
I cant seem to get my sprites to display at all. I'm creating a sprite inside a scriptobject, at first i thought that was the problem but I added a bit at the start to just display a sprite as a test, it doesnt even display that.
btw, the dump call in there works so it seems like it might be getting created then destroyed.
This is what i added at the start to test things out
I get the feeling i'm missing something really basic and obvious here :S
new ScriptObject(Infant)
{
postion = "0 0";
size = 10;
speed = 5;
name = "NULL";
type = "infant";
state = "idle";
imageMap = "InfantImageMap";
sprite = "NULL";
};
function infant::onAdd(%this)
{
echo("Infant " @ %this.name @ " created");
echo("State = " @ %this.state);
//create a sprite to go along with this
%this.sprite = new t2dStaticSprite() {scenegraph = t2dSceneGraph;};
%this.sprite.setsize("20 20");
%this.sprite.setPosition("0 0");
%this.sprite.setImageMap(ForestMossImageMap);
%this.sprite.dump();
%this.controller(%this);
}btw, the dump call in there works so it seems like it might be getting created then destroyed.
This is what i added at the start to test things out
%sprite = new t2dStaticSprite() {scenegraph = t2dSceneGraph;};
%sprite.setsize("20 20");
%sprite.setPosition("0 0");
%sprite.setImageMap(ForestMossImageMap);I get the feeling i'm missing something really basic and obvious here :S
About the author
#2
09/15/2006 (4:00 pm)
You have scenegraph = t2dSceneGraph which will only work if your t2dSceneGraph is named "t2dSceneGraph" which I don't necessarily think is a good idea. Rename the scenegraph to be something else, "t2dScene" is common, and set the scenegraph to be that instead.
Torque Owner Torque3a
Richard N.