Gamestudio Links
Zorro Links
Newest Posts
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
2 registered members (TipmyPip, AndrewAMD), 1,151 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Level Load Behavior #436647
01/30/14 17:29
01/30/14 17:29
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
I have created a level load behavior that works fine to load the second level. Trouble is, I want to create more than one level and that would mean creating a different behavior for each level. I'd like to create a behavior that brings a up a pop-up that I can type in the name of the new level (and thus not code a different behavior for each level).

Here's what I have so far:
Code:
function level_Change() { 
	
	while(1){ 
	
		if(event_type == EVENT_PUSH){
			wait(3);
			level_load("shooter.wmb");  //use this if you are making level 2
			wait_for(level_load);  //use this if you are making level 2
			return;					//use this if you are making level 2
		}	
		
		wait(1);
	}
}
action touch_Entity() { 
	my.emask = ENABLE_PUSH;
	my.group = 2;
	
	while(1){
		wait(1);
		my.event = level_Change; 
	}
}


Any ideas would be really appreciated!

Re: Level Load Behavior [Re: mschoenhals] #436648
01/30/14 17:35
01/30/14 17:35
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
There are (of course) multiple ways to do this, for example these two:

Code:
void level_Change()
{ 	
	if(you == player) my.skill10 = 0;
}

action touch_Entity()
{ 
	my.event = level_Change; 
	my.emask |= ENABLE_PUSH;
	my.group = 2;
	
	my.skill10 = 1;
	while(my.skill10) wait(1);
	level_load(my.string1);
}


Here you can enter the name of the next level in the entity's first string field in WED.

Other approach:
Code:
TEXT* txt_level_names =
{
	string("shooter.wmb","outdoor.wmb");
}

void level_Change()
{ 	
	if(you == player) my.skill10 = 0;
}

//skill1: level_id 0
action touch_Entity()
{ 
	my.event = level_Change; 
	my.emask |= ENABLE_PUSH;
	my.group = 2;
	
	my.skill10 = 1;
	while(my.skill10) wait(1);
	level_load((txt_level_names.pstring)[my.skill1]);
}


Here you can use a text object as an easy way to realize a string array, then write your level names into the string parameter and then use the first entity skill as an index to load the appropriate level.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Level Load Behavior [Re: Superku] #436649
01/30/14 17:45
01/30/14 17:45
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Thanks for the response.
I put the code in and entered shooter.wmb in the first string. Now I only get a sky box when I come into contact with the entity.

Re: Level Load Behavior [Re: mschoenhals] #436651
01/30/14 18:07
01/30/14 18:07
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Then debug your code/ game/ level and try to isolate the problem.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

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