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 (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
My level changing script #55866
09/22/05 11:37
09/22/05 11:37
Joined: Sep 2005
Posts: 42
SusanJ Offline OP
Newbie
SusanJ  Offline OP
Newbie

Joined: Sep 2005
Posts: 42
This is the script i made to let me change levels in my game and i thought i would share it, maybe you can use it in your game too. Ive only been using 3DGS for a few weeks so please be gentle when reviewing my code .

All the other level changing scripts ive managed to find have been where you have to use 2 different files and create a new file for every level you want to load/change to. So heres how i do it, the newb way hehe.

Create the appropriate level strings at the top of your game script like:
string level_str = <level1.WMB>;
string level_str2 = <level2.WMB>; ..etc etc

Code:
 
var levell=1;

function nextlevel
{while(vec_dist(my.x,player.x)>10){wait(1);}my.passable=on;remove(my);levell+=1;{
if(levell==2){level_load(level_str2);}
if(levell==3){level_load(level_str3);}
if(levell==4){level_load(level_str4);}
if(levell==5){level_load(level_str5);};wait(1);
}
}

action level_exit
{my.passable=on;nextlevel();
}



then i just put an entity in my level for my exit and assigned the level_exit action to it and when my player touches that it loads the next level. maybe theres an easier way to do it i dont know but im a beginner and proud of myself for making that hehe.

hope it helps someone

Re: My level changing script [Re: SusanJ] #55867
09/24/05 21:48
09/24/05 21:48
Joined: Aug 2002
Posts: 673
Las Cruces, NM
JimFox Offline
User
JimFox  Offline
User

Joined: Aug 2002
Posts: 673
Las Cruces, NM
Hi SusanJ,
That is an interesting way to do it. Good thinking.
Thanks for sharing.
Regards,


Jim
Re: My level changing script [Re: JimFox] #55868
09/24/05 22:17
09/24/05 22:17
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Good work.
Thank you.
Take it without if:
Code:

string level_str = <level1.WMB>;
string level_str2 = <level2.WMB>; //..etc etc
string level_next;
string temp_num;
var levell=1;

function nextlevel{
while(vec_dist(my.x,player.x)>10){wait(1);}
my.passable=on; remove(my); levell+=1;
str_cpy(level_next,"level");
str_for_num(temp_num,int(levell));
str_cat(level_next,temp_num);
str_cat(level_next,".wmb");
level_load(level_next);
wait(2);
}

action level_exit{
my.passable=on;nextlevel();
}


You don't need expand if branches now, when new levels added

Last edited by Lion_Ts; 09/24/05 22:21.

Moderated by  adoado, checkbutton, mk_1, Perro 

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