Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 1,498 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 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