To make doors, is actually quite simple.
First you create the door, and start cloning it, then make a variable for player to enter door, and a variable to store the doornumber. Then arrange your doors so that they are sequential cloneindexes.
That is, door 0 and door 1 lead to each other, door 2 and door 3 lead to each other, etc. etc.
Player>Collision>Any Side>Door>
- Code: Select all
doorvar=1;
doornum=collide.cloneindex;
player> collisionfinish>door>
- Code: Select all
doorvar=0;
player>key down>up (or whatever key enters door){
- Code: Select all
Actor*this;
int i;
int newdoornum;
if(doorvar==1){ //if player is touching a door
int i=doornum%2; //figure out even/odd door cloneindex
if(i==0){ //if door cloneindex is a multiple of 2 (0, 2, 4, 6, 8, etc etc)
newdoornum=doornum+1; } //then get next door (0 leads to 1, 2 leads to 3)
else { //if door is not multiple of 2
newdoornum=doornum-1;} //then get previous door (1 leads to 0, 3 leads to 2)
this=getclone2("door", newdoornum); //get the new door to warp to using getclone2
player.x=this->x;
player.y=this->y; //move to new door coordinates.
} //end if doorvar check.