function checkCollisions() {
	for (i = 0; i < pipes.length; i++) {
		// hit pipe
		if (player.x < pipes[i].virtx + pipe32.width && player.x + player_sprite.width  > pipes[i].virtx && player.y < pipes[i].y + pipe32.height && player.y + player_sprite.height > pipes[i].y) {
			if (multi == true) {
				die();
			}
		}

		// went through pipe
		if (player.dead == false && pipes[i].virtx < player.x && pipes[i].passed == false) {
			pipes[i].passed = true;
		}
	}

	// hit floor
	if (player.y + player_sprite.height >= canvas.height - floor.height) {
		if (multi == true) {
			die();
		} else {
			// bouncy
			player.velocity = jump;
		}
	}

	// hit celing
	if (player.y <= 0) {
		player.y += 15;
	}
}
/** 
 * Check if the player hit anything or got past obstacles
 */
Check if the player hit anything or got past obstacles
Check if the player hit anything or got past obstacles
function checkCollisions() {
	for (i = 0; i < pipes.length; i++) {
		if (player.x < pipes[i].virtx + pipe32.width && player.x + player_sprite.width  > pipes[i].virtx && player.y < pipes[i].y + pipe32.height && player.y + player_sprite.height > pipes[i].y) {
			if (multi == true) {
				die();
			}
		}
		if (player.dead == false && pipes[i].virtx < player.x && pipes[i].passed == false) {
			pipes[i].passed = true;
		}
	}
	if (player.y + player_sprite.height >= canvas.height - floor.height) {
		if (multi == true) {
			die();
		} else {
			player.velocity = jump;
		}
	}
	if (player.y <= 0) {
		player.y += 15;
	}
}
function checkCollisions ( ) { for ( i = 0 ; i < pipes . length ; i ++ ) { if ( player . x < pipes [ i ] . virtx + pipe32 . width && player . x + player_sprite . width > pipes [ i ] . virtx && player . y < pipes [ i ] . y + pipe32 . height && player . y + player_sprite . height > pipes [ i ] . y ) { if ( multi == true ) { die ( ) ; } } if ( player . dead == false && pipes [ i ] . virtx < player . x && pipes [ i ] . passed == false ) { pipes [ i ] . passed = true ; } } if ( player . y + player_sprite . height >= canvas . height - floor . height ) { if ( multi == true ) { die ( ) ; } else { player . velocity = jump ; } } if ( player . y <= 0 ) { player . y += 15 ; } }
Check if the player hit anything or got past obstacles
Check if the player hit anything or got past obstacles
// hit pipe // went through pipe // hit floor // bouncy // hit celing