Levelchange (Run against invisible Object)

From GameStudio Wiki

Jump to: navigation, search

To change the level, place a model at the position where the player has to go to change it, assign the action Lvl_Change_Run to it and set the levelnumber to be loaded for skill1 in its behavior panel (beginning with 1).

The following textobject is used to store the level filenames (change it to your desires):

text Missions_txt
{
     strings = 3; //Number of Levels +1 (3 for are 2 possible Levels)
     string = "",
              "Level1.wmb", //Names of the Levelfiles (this will be loaded for 1)
              "Level2.wmb"; //this for 2
}

This is the action with its event to load the new level:

function LevelLoad_event()
{
     my.enable_impact = off;

     var LevelNum;
     LevelNum = my.skill1;

     my = NULL;
     you = NULL;

     level_load(Missions_txt[LevelNum]);
     wait(3);
}

//skill1: LevelNumber 1
action Lvl_Change_Run()
{
     my.enable_impact = on;
     my.event = LevelLoad_event;

     my.polygon = on;
     my.fat = off;
     my.narrow = off;

     my.invisible = on;
}

--Slin 05:31, 4 November 2007 (CET)

Personal tools