Change level in Platform Game
by gaetano · in Torque Game Builder · 03/04/2011 (6:57 am) · 4 replies
Hello
I've a simple question.
How can I change level in my platform game?
I did the first level.
When i arrive at the level's end i should change level.
How can i do it?
I've a simple question.
How can I change level in my platform game?
I did the first level.
When i arrive at the level's end i should change level.
How can i do it?
#2
Thanks for the patience! ^^
03/04/2011 (8:44 am)
xD sorry but i'm a noob in script theme. I don't know how to do it. Can you tell me the function and where i should put it?Thanks for the patience! ^^
#3
Write this in a file with an appropriate name and save it in the game/behaviors/ folder:
Now drag a trigger to the level exit area, and add the behaviour from the dropdown in the Edit panel. Write the basename of the level to load (that is, without path and the .t2d extension) in the Level box. Once you learn a bit more, you'll want to verify the %other variable in onEnter() so that it only responds to the player, and not any other object strolling by.
03/04/2011 (10:03 am)
Easy-mode engage!Write this in a file with an appropriate name and save it in the game/behaviors/ folder:
if (!isObject(LevelTrigger))
{
%template = new BehaviorTemplate(LevelTrigger);
%template.friendlyName = "Level Trigger";
%template.behaviorType = "Trigger";
%template.description = "Loads a new level when entered";
%template.addBehaviorField(Level, "The level to load", string, "");
}
function LevelTrigger::onEnter(%this, %other)
{
%level = "game/data/levels/" @ %this.Level @ ".t2d";
sceneWindow2D.schedule(1, "loadLevel", %level);
}Now drag a trigger to the level exit area, and add the behaviour from the dropdown in the Edit panel. Write the basename of the level to load (that is, without path and the .t2d extension) in the Level box. Once you learn a bit more, you'll want to verify the %other variable in onEnter() so that it only responds to the player, and not any other object strolling by.
#4
03/06/2011 (9:34 am)
Thank you so much Ronny ^^
Torque 3D Owner Ronny Bangsund
Torque Cheerleaders