|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: passing level
[Re: Funeral]
#284117
08/11/09 19:14
08/11/09 19:14
|
Joined: Jul 2009
Posts: 3 Colorado, United States
Gil_Villarreal
Guest
|
Guest
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...
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
Funeral
OP
Junior Member
|
OP
Junior Member
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); }
|
|
|
|