function afterCollision(event)
{
	if (!is_playing())
		return;
	//console.log("after collision");

	for(var k in event.pairs)
	{
		var a = event.pairs[k].bodyA;
		var b = event.pairs[k].bodyB;
		if ((a.name == "ball" && b.name == "target") || (a.name == "target" && b.name == "ball"))
		{
			//console.log("Target hit detected..." + current_state + ',' + current_level);
			//console.log(engine.world.bodies);
			// Run next level in 5 seconds...
			current_state = STATE_TARGET_HIT;
			fvis.highlight('END');
			var _starfield_speedup = function() {
				if (current_state == STATE_TARGET_HIT)
				{
					camera.moveZoom(DEBUG ? -80 : -8);
					starfield.vmultiplier += DEBUG ? 0.2 : 0.02;
					setTimeout(_starfield_speedup, 15);
				}
			};
			updateVisTime(current_tab);
			level_name = current_level;
			send_analytics();
			_starfield_speedup();
			setTimeout(function() { run_level(current_level + 1); }, DEBUG ? 500 : 5000);
			break;
		}
	}
}
// Check to see if the ball collided with the target
Check to see if the ball collided with the target
Check to see if the ball collided with the target
function afterCollision(event)
{
	if (!is_playing())
		return;
	for(var k in event.pairs)
	{
		var a = event.pairs[k].bodyA;
		var b = event.pairs[k].bodyB;
		if ((a.name == "ball" && b.name == "target") || (a.name == "target" && b.name == "ball"))
		{
			current_state = STATE_TARGET_HIT;
			fvis.highlight('END');
			var _starfield_speedup = function() {
				if (current_state == STATE_TARGET_HIT)
				{
					camera.moveZoom(DEBUG ? -80 : -8);
					starfield.vmultiplier += DEBUG ? 0.2 : 0.02;
					setTimeout(_starfield_speedup, 15);
				}
			};
			updateVisTime(current_tab);
			level_name = current_level;
			send_analytics();
			_starfield_speedup();
			setTimeout(function() { run_level(current_level + 1); }, DEBUG ? 500 : 5000);
			break;
		}
	}
}
function afterCollision ( event ) { if ( ! is_playing ( ) ) return ; for ( var k in event . pairs ) { var a = event . pairs [ k ] . bodyA ; var b = event . pairs [ k ] . bodyB ; if ( ( a . name == "ball" && b . name == "target" ) || ( a . name == "target" && b . name == "ball" ) ) { current_state = STATE_TARGET_HIT ; fvis . highlight ( 'END' ) ; var _starfield_speedup = function ( ) { if ( current_state == STATE_TARGET_HIT ) { camera . moveZoom ( DEBUG ? - 80 : - 8 ) ; starfield . vmultiplier += DEBUG ? 0.2 : 0.02 ; setTimeout ( _starfield_speedup , 15 ) ; } } ; updateVisTime ( current_tab ) ; level_name = current_level ; send_analytics ( ) ; _starfield_speedup ( ) ; setTimeout ( function ( ) { run_level ( current_level + 1 ) ; } , DEBUG ? 500 : 5000 ) ; break ; } } }
Check to see if the ball collided with the target
Check to see if the ball collided with the target
//console.log("after collision"); //console.log("Target hit detected..." + current_state + ',' + current_level); //console.log(engine.world.bodies); // Run next level in 5 seconds...