// chrono
if (!global.perdu) {
	global.secondes -= 1/room_speed;

	if (global.secondes <= 0) {
		global.minutes --;
		global.secondes = 20;
		if (global.minutes < 0) {
		global.perdu = true;
		}
	}	
}

// transition

if (global.transition != -1) {
	switch(global.transition) {
		case 0 : 
			if (posY = 0) posY = 3;
			else posY --; break;
		case 1 :
			if (posX = 3) posX = 0;
			else posX ++; break;
		case 2 :
			if (posY = 3) posY = 0;
			else posY ++; break;
		case 3 :
			if (posX = 0) posX = 3;
			else posX --; break;
	}
	global.spawn = global.transition;
	global.transition = -1;
	room_goto(asset_get_index("r" + string(tableau[posX, posY])));
}

// défaite

if (global.perdu) {
	room_goto(rOver);
	global.perdu = false;
}	

// contact avec objet maudit

with (oPlayer) {
	if place_meeting(x,y,oMaudit) {
		global.minutes = 5;
		room_goto(rWin);
	}
}	

// ouverture des portes

if (room != rOver and room != rWin and !instance_exists(oMonsterMelee)) oTransition.image_index = 1;
