Game Development Community

Prototype from TGB to iT2D

by Tyler Slabinski · in iTorque 2D · 11/16/2010 (1:22 am) · 4 replies

Okay, I've finished up my game's prototype in TGB and I am attempting to port it into iT2D. Unfortunately, I have no experience with iT2D at all, and the documentation hasn't really been much help to me. My main problem is pretty easy; loading a level. In TGB, I am very use to just loading the level that the builder is open to, so I never familiarized myself with it. I've tried looking through the scripts, but everything I've tried did not lead to any noticeable results.

How do load a basic level? Just a simple "prototypeScene.t2d" file, which I can't for the life of me figure out.

#1
11/16/2010 (4:38 am)
It's pretty much the same with iT2D as it is with TGB. Look at t2dSceneWindow::loadLevel(%sceneWindow, %levelFile). It should be in projectFiles/game/scripts/game.cs.

#2
11/17/2010 (1:53 am)
Okay, I found this function in my "game.cs" file:

sceneWindow2D.loadLevel(%level);

I am guessing that's the function you meant, because I can't find any other function similar to that. I traced %level to "./game/main.cs", which puts it as:

expandFilename($Project::Game::DefaultScene)

I've traced $Project::Game::DefaultScene to two different possible files. "common/defaultPrefs.cs" and "common/scripts/properties.cs" as these:

$Project::Game::DefaultScene        = "~/data/levels/untitled.t2d";

and

$Project::Game::DefaultScene      = %xml.readField( "DefaultScene" );

//And further down as:

$Project::Game::DefaultScene        = "~/data/levels/untitled.t2d";

I've changed the "untitled.t2d" to my level's name with no effect, and I am not about to go changing any XML files. Besides, I highly believe I've already went too far, since this is way different than how TGB does things.

Something tells me I am making a very simple mistake and that I'm looking too far into things. Any help?
#3
11/17/2010 (5:42 am)
in game.cs use this line instead and it should work.

sceneWindow2D.loadLevel("game/data/levels/prototypeScene.t2d");
#4
11/17/2010 (8:25 pm)
EDIT: Well, don't I feel like an idiot... I just found out that I need to make a datablock for each ImageMap. I guess I shouldn't have skipped reading the documentation?

EDIT2: Okay, I can find examples for datablocks for ImageMaps and Animations, but I can't seem to be able to find examples for TileMaps or ParticleEffects.