Sync Tutorial - Adding Levels
Now that the basic game play is finished we can add different levels to the game.

Copy an enemy then delete all the enemies on the screen.
Go to file, new level in Torque.

Paste a few Enemies near the boarders of the camera.
You can change the properties of the EnemyA behavior to make the AI different.
Save the level as Level1

Make a new level. Add some more enemies. Change their properties so they are harder than Level1. Then Save as Level2

Add this code to function EnemyABehavior::onBehaviorAdd(%this) in the EnemyA.cs file
$Enemies += 1;

Add this code to the function EnemyClassA::Explode(%
this)

$Enemies += -1;
if($Enemies <= 0)
{
LoadNextLevel();
}
Add this code to the function EnemyABehavior::onBehaviorAdd(%this).
$Enemies += 1;
Replace the line of code that reads: sceneWindow2D.loadLevel(%level); with this code in the game.cs file located in the gamescripts folder.
sceneWindow2D.loadLevel("game/data/levels/Battlefield.t2d");
   LoadNextLevel();
Add the end of the document add the following code:
function LoadNextLevel()
{
$Levels += 1;
if($levels == 1)
{
sceneWindow2D.addtoLevel(
"game/data/levels/Level1.t2d");
}
if($Levels == 2)
{
sceneWindow2D.addtoLevel(
"game/data/levels/Level2.t2d");
}
if($Levels > 2)
{
$Levels += -3;
LoadNextLevel();
}
//add more levels. Possibly if level is greater than 15 loop levels 10-15.
}
Alright now we have created multiple levels of difficulty for the player to play against.
Lets move on to creating particle effects.
Next Page
Previous Page