Noob Getting started
by Reggie Sanchez · in Torque X 2D · 02/19/2007 (11:05 am) · 5 replies
I'm trying to use the Starter template to begin my program. I created a simple sprite and marked as a template. I then tried to clone it to get it to show up, but I only get a blank screeen. Any help as to what I'm missing is appreciated. Some code below:
protected override void BeginRun()
{
gameData _gameData;
_gameData = new gameData();
base.BeginRun();
// load our scene objects from XML. TorqueX is designed to load game data from XML, but this is not strictly required;
// anything in an XML file can also be created manually in C# code. The SceneLoader is provided by TorqueGame and can be
// used to load and unload XML files.
SceneLoader.Load(@"data/levels/levelData.txscene");
if (_gameData.GetOTemplate().Object != null)
{
_player = (T2DSceneObject)_gameData.GetOTemplate().Object.Clone();
_player.Position = new Vector2(100.0f, 100.0f); // 1.5 = slop factor
TorqueObjectDatabase.Instance.Register(_player);
}
}
protected override void BeginRun()
{
gameData _gameData;
_gameData = new gameData();
base.BeginRun();
// load our scene objects from XML. TorqueX is designed to load game data from XML, but this is not strictly required;
// anything in an XML file can also be created manually in C# code. The SceneLoader is provided by TorqueGame and can be
// used to load and unload XML files.
SceneLoader.Load(@"data/levels/levelData.txscene");
if (_gameData.GetOTemplate().Object != null)
{
_player = (T2DSceneObject)_gameData.GetOTemplate().Object.Clone();
_player.Position = new Vector2(100.0f, 100.0f); // 1.5 = slop factor
TorqueObjectDatabase.Instance.Register(_player);
}
}
#2
02/19/2007 (11:18 am)
Nope just a blank screen.
#3
02/19/2007 (11:24 am)
Did you open it up in TGBX and see if the GarageGames logo is shown there? Try that and see if you can see it. Also try creating a new template, changing nothing, and running it to see if you see the movable GG logo. If not, I think you have bigger fish to fry than your code.
#4
02/19/2007 (11:37 am)
Well I added a new sprite without checking the clone checkbox. Once I run it appears, but I get no garagegames logo.
#5
02/19/2007 (11:40 am)
Ugh What a goof I am! When I placed the new sprite I noticed its positioning. Once i changed its positioning to that, the cloned sprite appeared. Thanks for the help!
Torque 3D Owner Jonathon Stevens
If so, do you see the GarageGames logo on the screen at all?