Branch ON when kill all enemies

dantedevil

Well-known member
I want create levels with the system of Splaterhouse 3. I mean when the doors to branch other levels open when kill all enemies.
I never works with branch, so I don't have any idea how works to make this.
 
Ah that one, I've created something similar before and it's called The House
It is crude and uses a lot of redundant entities but the system works i.e player must kill all enemies before allowed to access any doors

I have better and more efficient method now, give me time to test it :)

Oh yes, I should mention that all levels in this system must be endless
 
I just realized that the trick in creating Splatter House 3 styled rooms doesn't lie in creating special doors which opens after enemies are defeated BUT instead lie in placing the doors in exact coordinates
See this example:
Code:
group	3 3
at	0

spawn	enemy
coords	-60 415
at	0

spawn	enemy
coords	440 420
at	0

spawn	enemy
coords	-60 415
at	 0

spawn	enemy
coords	380 415
at	0

group	1 1
at	 0

spawn	delay
coords	160 415
at	 0

spawn	 Door1
@script
void main()
{
    void self = getlocalvar("self");

    changeentityproperty(self, "position", 995);
}
@end_script
flip	1
coords	995 410
at	 0

spawn	 Door2
@script
void main()
{
    void self = getlocalvar("self");

    changeentityproperty(self, "position", 500);
}
@end_script
coords	500 440
at	0

In this example, Door1 and Door2 are only spawned after all 4 enemies are defeated. Though, both has script which forces their spawn coordinate in exact x coords
You can use endlevel type and set branch to create each Door but if your doors are uniform shaped this would be inefficient. I have the script to solve this problem allowing you to use type none and define branch by setting alias in level :)

Before I shared the script, do you understand the idea?
 
I don understand wath mean with " but if your doors are uniform shaped this would be inefficient."
You mean the doors dont have animations, only simpple frame?
Sorry but i never use the branch feature, so all this is new for me.
 
I don understand wath mean with " but if your doors are uniform shaped this would be inefficient."
You mean the doors dont have animations, only simpple frame?

:-[ Ah, I used wrong words. I mean "if your doors use generic sprite set or animations, this would be inefficient"

IIRC doors in Splatter House 3 are the same in every room meaning you could use same door entity for every room. You can create the door entity with endlevel type like this:

name Door1
type endlevel
branch  Room1

anim idle
delay 10
offset 1 1
        bbox    0 126 70 17
frame data/bgs/house/door.png

However, this door entity only brings player to Room1 branch IOW can't be used for doors which brings player to other rooms
If you had 10 rooms, it would be inefficient creating similar door entities like this for each room
That's why I use script to replace this endlevel type and make it more efficient :)

Sorry but i never use the branch feature, so all this is new for me.

Read this tutorial then:

http://www.chronocrash.com/forum/index.php?topic=20.0

You should try creating simple branches first and get used to it
 
Hey Bloodbane, any news about this:
However, this door entity only brings player to Room1 branch IOW can't be used for doors which brings player to other rooms
If you had 10 rooms, it would be inefficient creating similar door entities like this for each room
That's why I use script to replace this endlevel type and make it more efficient
 
Ah I'm referring to this:

name Exit
type none
offscreenkill 3000


anim idle
@script
    void self = getlocalvar("self");
    void P1 = getplayerproperty(0, "entity");
    void P2 = getplayerproperty(1, "entity");

    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");
    char Name = getentityproperty(self,"name");
    float Tx1 = getentityproperty(P1, "x");
    float Tz1 = getentityproperty(P1, "z");
    float Tx2 = getentityproperty(P2, "x");
    float Tz2 = getentityproperty(P2, "z");

    float Disx1 = Tx1 - x;
    float Disz1 = Tz1 - z;
    float Disx2 = Tx2 - x;
    float Disz2 = Tz2 - z;

    if(Disz1 < 0){
      Disz1 = -Disz1;
    }

    if(Disz2 < 0){
      Disz2 = -Disz2;
    }

    if(frame >= 1){
      if(Disx1 >= -20 && Disx1 <= 20 && Disz1 <= 10){
        jumptobranch(Name, 1);
      } else if(Disx2 >= -20 && Disx2 <= 20 && Disz2 <= 10){
        jumptobranch(Name, 1);
      }
    }
@end_script
loop 1
delay 6
offset 30 70
frame DATA/chars/misc/direction/11.gif
frame DATA/chars/misc/direction/12.gif
frame DATA/chars/misc/direction/13.gif
frame DATA/chars/misc/direction/14.gif

This Exit entity can be used for different destinations, for instance:

spawn Exit
alias Room1
coords 100 150
at 0

spawn Exit
alias Room2
coords 400 150
at 0

These 2 Exit are same entity yet each brings player to different branch defined by their alias
 
Back
Top Bottom