Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
passing level #284101
08/11/09 18:36
08/11/09 18:36
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
like a plataform game i've placed items through the level and the question is how can i move to aanother level when i've picked up a certain number of this item. am using a variable and 5 items and digits to count the number of items i've picked up as in the lite-c workshop what i want its that when the digits get to 5 the next level is loaded

Re: passing level [Re: Funeral] #284115
08/11/09 19:08
08/11/09 19:08
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
level_load("next_level.wmb");

- that's it. You don't have to release the old level or whatever. Only, if you get empty pointer errors, you have to do something about that, but that's within the functions where you use that pointers.

Re: passing level [Re: Funeral] #284117
08/11/09 19:14
08/11/09 19:14
Joined: Jul 2009
Posts: 3
Colorado, United States
G
Gil_Villarreal Offline
Guest
Gil_Villarreal  Offline
Guest
G

Joined: Jul 2009
Posts: 3
Colorado, United States
Here's what works for me...

I have a while loop running in my main() function. It is waiting for the loadNewLevel global var to be set to TRUE. Here is an example...

Code:
var loadNewLevel = FALSE;
STRING* levelName = "myLevel.wmb";


main()
{

  ...
  ...

  while(player) //basically loops as long as you are playing
  {
    if(loadNewLevel)
    {
      level_load(levelName); //use a global string set to the name of the level to load

      wait(3); // must have for level to load properly!
      loadNewLevel = FALSE;  //reset our global trigger
    }
    else
    {
      wait(1); //do nothing until loadNewLevel is TRUE
    }
  }
}



So basically, whatever condition must be met to trigger a level load, should set the loadNewLevel var to TRUE.

Hope that helps!

Last edited by Gil_Villarreal; 08/11/09 19:17.
Re: passing level [Re: Pappenheimer] #284162
08/12/09 00:20
08/12/09 00:20
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
yes i know that, the thing is that i dont know is how to make the entire code and where to place it.
i tried something like :

if (item = 5)
level_load("levelname")

i dont know if that's right or not

this is the my code, so you can check it and tell me how to do it right



///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
var item = 0;


function main()
{
level_load("z.wmb");
}


PANEL* first_pan =
{
digits (10, 10, 2, *, 1, item);
flags = VISIBLE;
}



action player_script()
{
while(1)
{
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY | ENABLE_IMPACT);
camera.tilt += joy_1;
camera.tilt -= joy_2;
camera.pan += joy_5;
camera.pan -= joy_6;
camera.x = my.x -150;
camera.y = my.y;
c_move(my, nullvector, vector(joy_force.y/2 , joy_force.x/-2 , 0), GLIDE);
wait(1);
}
}


function bounce_event()
{
if (event_type == EVENT_IMPACT)
{
ent_remove(me); // disappear when hit
item +=1;

}
}

function item_pickup()
{
my.emask |= ENABLE_IMPACT;
my.event = bounce_event;
reset(my,PASSABLE);
}

Re: passing level [Re: Funeral] #284166
08/12/09 00:59
08/12/09 00:59
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
function main()
{
level_load("z.wmb");

while(1)
{

if (item == 5)
level_load("x.wmb");

wait(1);
}

}


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1