Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 12,726 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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