Game Development Community

Level doesn't want to load

by Andrea Farid Marsili · in iTorque 2D · 04/24/2011 (3:49 am) · 5 replies

EDIT:

FOUND THE ERROR:

I replace

sceneWindow2D.loadLevel(%this.level);

with:

%level = "game/data/levels/" @ %this.level @ ".t2d";
sceneWindow2D.schedule(1, "loadLevel", %level);

But now I get another error:

HERE A VIDEO



When i try to load a level my project crash.

This is the console log:
Quote:
Loaded compiled script /Applications/iTorque2D_1_4_1/MyProjects/MainMenuConcept/projectFiles/game/gui/mainScreen.gui. Took 8 ms
% - MainScreen set to Landscape! 480x320
Loaded compiled script /Applications/iTorque2D_1_4_1/MyProjects/MainMenuConcept/projectFiles/game/scripts/game.cs. Took 0 ms
game/scripts/game.cs (24): Unable to find function enableJoystick
% - Game load time : 180 ms
--------Loading Resource file game/PlatformerArt/MainMenuLvlResources.cs
--------Adding to Level game/data/levels/MainMenuLvl.t2d
--------Exec()ing level datablocks game/data/levels/datablocks/MainMenuLvl_datablocks.cs
Loaded compiled script /Applications/iTorque2D_1_4_1/MyProjects/MainMenuConcept/projectFiles/game/data/levels/datablocks/MainMenuLvl_datablocks.cs. Took 124 ms
--------Exec()ing level game/data/levels/MainMenuLvl.t2d
Loaded compiled script /Applications/iTorque2D_1_4_1/MyProjects/MainMenuConcept/projectFiles/game/data/levels/MainMenuLvl.t2d. Took 1 ms
--------Loading Resource file game/PlatformerArt/level2Resources.cs
--------Adding to Level gamelevel2.t2d

And this is my code:
if(!isObject(MainMenuButtonBehavior)){
	%template = new BehaviorTemplate(MainMenuButtonBehavior);

	%template.friendlyName = "Level Button";
	%template.behaviorType = "GUI";
	%template.description  = "Loads a new level when clicked";

	%template.addBehaviorField(level, "The level to load on mouse down", string, "");
}

function MainMenuButtonBehavior::onBehaviorAdd(%this){
	%this.owner.setUseMouseEvents(true);
}

function MainMenuButtonBehavior::onMouseDown(%this, %modifier, %worldPos){
	sceneWindow2D.loadLevel(%this.level);
}

I had wrote level2.t2d in behavior field in iT2D. But the console.log say that I'm trying to load gamelevel.t2d and it also try to load PlatformerArt...why?
PS: I've got PSK for PC and MAC but not for iOS

#1
04/24/2011 (9:30 am)
I would like to find some answers as I have been experiencing some similar issues. At the moment I am unsure of what the remedy would be for you. Just check file names, directories clear out all dos's etc.




#2
04/25/2011 (1:41 am)
I get this error only on iT2D preview, if I build my project with Xcode all thing work like a charm.
#3
04/25/2011 (8:34 pm)
Now you have your new error, can you please post all the latest log information.
#4
04/26/2011 (12:16 am)
Quote:
Torque Game Builder (v1.7.5) initialized...
iTorque 2D v1.4.1 is active...
Compiling /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/scripts/behaviors/MoveToBehavior.cs...
creating path /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/scripts/behaviors/MoveToBehavior.cs.dso
Compiling /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/scripts/behaviors/MainMenuButtonBehavior.cs...
creating path /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/scripts/behaviors/MainMenuButtonBehavior.cs.dso
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/scripts/behaviors/MoveToBehavior.cs. Took 1 ms
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/scripts/behaviors/MainMenuButtonBehavior.cs. Took 0 ms
Failed to load profile bitmap ()
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/gui/mainScreen.gui. Took 22 ms
% - MainScreen set to Landscape! 480x320
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/scripts/game.cs. Took 1 ms
game/scripts/game.cs (24): Unable to find function enableJoystick
% - Game load time : 1892 ms
--------Loading Resource file game/PlatformerArt/MainMenuLvlResources.cs
--------Adding to Level game/data/levels/MainMenuLvl.t2d
--------Exec()ing level datablocks game/data/levels/datablocks/MainMenuLvl_datablocks.cs
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/data/levels/datablocks/MainMenuLvl_datablocks.cs. Took 136 ms
--------Exec()ing level game/data/levels/MainMenuLvl.t2d
Compiling /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/data/levels/MainMenuLvl.t2d...
creating path /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/data/levels/MainMenuLvl.t2d.dso
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/data/levels/MainMenuLvl.t2d. Took 1 ms
--------Loading Resource file game/PlatformerArt/level2Resources.cs
--------Adding to Level game/data/levels/level2.t2d
--------Exec()ing level datablocks game/data/levels/datablocks/level2_datablocks.cs
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/data/levels/datablocks/level2_datablocks.cs. Took 2 ms
--------Exec()ing level game/data/levels/level2.t2d
Loaded compiled script /Users/andrea/Documents/Footprint Game/Behavior per Dispersio/ExampleProjects/MainMenuConcept/projectFiles/game/data/levels/level2.t2d. Took 1 ms
creating path /Users/andrea/Library/Application Support/com.yourcompany.appname/MyGame/common/commonConfig.xml
Shutting down the OpenGL display device...
Cleaning up the display device...
Killing the texture manager...
Clearing the current AGL context...
Clearing the current drawable...
Deleting the rendering context...
Destroying the window...

Here's the log.
#5
04/30/2011 (3:56 pm)
To fix mine, I just did a reinstall, and added over the project in pieces.












Not sure if that would solve yours, but it solved mine.