Game Development Community

Sprite turns transparent when moved to a different scenegraph

by C J · in Torque Game Builder · 03/02/2013 (9:02 pm) · 0 replies

I have a game with two levels and a doorway from the first level to the second level. When the player object, a t2dAnimatedSprite, collides with the door, it calls the following functions:

function Door::switchLevel(%this, %scenegraph_dest, %scenegraph_dest_position) {
//remove the player from the current scene
$Player.schedule(0, removeFromScene);
//set his position on the new map
$Player.schedule(64, setPosition, %scenegraph_dest_position);
//unload the current scene, load the destination one.
sceneWindow2d.schedule(0, endLevel);
sceneWindow2d.schedule(32, loadLevel, expandFilename("~/data/levels/" @ %scenegraph_dest @ ".t2d"));
//once we've loaded this map, add the player to it after 4 frames worth of ms
$Player.schedule(128, DoorUpdatePlayerScenegraph);
}

function Player::DoorUpdatePlayerScenegraph(%this) {
%this.addToScene(sceneWindow2d.getSceneGraph());
}

I have an additional function that centers the camera on the player object, which works correctly between the two levels, and the destination level loads correctly. The problem I'm having is that my player object is translucent on the second map. Not 100% invisible, because I can definitely see him moving, but he basically looks like a Dark Templar from Starcraft moving around, which is definitely not intended behavior. Checking $Player.getAlphaBlend(); returns 1 on both levels, so I know it's not being inadvertently changed. Is there something I need to do to make sure the player object's imagemap gets loaded when it's added to a new scene, maybe?