function reset() {
	// intervals
	clearInterval(updateInterval);
	clearInterval(broadcastInterval);
	updateInterval = undefined;
	broadcastInterval = undefined;

	// terrain
	tiles = [];
	terrain_x = 0;

	// pipes
	pipes = [];

	// player
	player = {
		x: 80,
		y: 0,
		speed: 2.8,
		rotation: 0,
		lastrotation: 0,
		velocity: 0,
		dead: false
	}

	// network
	sessionID = undefined;
	id = makeid();
	multi = false;
	opponent = [];
	playing = false;

	// reset the socket
	socket.emit("restart", {});
	socket.socket.disconnect();

	// misc
	player.y = (canvas.height / 2) - player_sprite.naturalHeight;
	createTerrain();
	
	// menus
	$("#lose").fadeOut("slow", function() {
		$("#container").fadeIn("slow", function() {});
	});

	$("#win").fadeOut("slow", function() {
		$("#container").fadeIn("slow", function() {});
	});

	// create new intervals
	start();
}
/**
 * Reset the game for another game
 */
Reset the game for another game
Reset the game for another game
function reset() {
	clearInterval(updateInterval);
	clearInterval(broadcastInterval);
	updateInterval = undefined;
	broadcastInterval = undefined;
	tiles = [];
	terrain_x = 0;
	pipes = [];
	player = {
		x: 80,
		y: 0,
		speed: 2.8,
		rotation: 0,
		lastrotation: 0,
		velocity: 0,
		dead: false
	}
	sessionID = undefined;
	id = makeid();
	multi = false;
	opponent = [];
	playing = false;
	socket.emit("restart", {});
	socket.socket.disconnect();
	player.y = (canvas.height / 2) - player_sprite.naturalHeight;
	createTerrain();
	$("#lose").fadeOut("slow", function() {
		$("#container").fadeIn("slow", function() {});
	});
	$("#win").fadeOut("slow", function() {
		$("#container").fadeIn("slow", function() {});
	});
	start();
}
function reset ( ) { clearInterval ( updateInterval ) ; clearInterval ( broadcastInterval ) ; updateInterval = undefined ; broadcastInterval = undefined ; tiles = [ ] ; terrain_x = 0 ; pipes = [ ] ; player = { x : 80 , y : 0 , speed : 2.8 , rotation : 0 , lastrotation : 0 , velocity : 0 , dead : false } sessionID = undefined ; id = makeid ( ) ; multi = false ; opponent = [ ] ; playing = false ; socket . emit ( "restart" , { } ) ; socket . socket . disconnect ( ) ; player . y = ( canvas . height / 2 ) - player_sprite . naturalHeight ; createTerrain ( ) ; $ ( "#lose" ) . fadeOut ( "slow" , function ( ) { $ ( "#container" ) . fadeIn ( "slow" , function ( ) { } ) ; } ) ; $ ( "#win" ) . fadeOut ( "slow" , function ( ) { $ ( "#container" ) . fadeIn ( "slow" , function ( ) { } ) ; } ) ; start ( ) ; }
Reset the game for another game
Reset the game for another game
// intervals // terrain // pipes // player // network // reset the socket // misc // menus // create new intervals