|  | @@ -27,26 +27,30 @@ func _ready():
 | 
												
													
														
															|  |  	add_child(player)
 |  |  	add_child(player)
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  func _process(d):
 |  |  func _process(d):
 | 
												
													
														
															|  | -	center_camera()
 |  | 
 | 
												
													
														
															|  | 
 |  | +	move_camera()
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -func center_camera():
 |  | 
 | 
												
													
														
															|  | -	var position_accumulator = Vector2(0.0, 0.0)
 |  | 
 | 
												
													
														
															|  | -	var players = get_tree().get_nodes_in_group("players")
 |  | 
 | 
												
													
														
															|  | 
 |  | +func move_camera():
 | 
												
													
														
															|  |  	var living = get_tree().get_nodes_in_group("living")
 |  |  	var living = get_tree().get_nodes_in_group("living")
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  	if living.size() == 0:
 |  |  	if living.size() == 0:
 | 
												
													
														
															|  | -		# Keep camera in the last position
 |  | 
 | 
												
													
														
															|  | -		return
 |  | 
 | 
												
													
														
															|  | -
 |  | 
 | 
												
													
														
															|  | -	for p in living:
 |  | 
 | 
												
													
														
															|  | 
 |  | +		# Show every players
 | 
												
													
														
															|  | 
 |  | +		var players = get_tree().get_nodes_in_group("players")
 | 
												
													
														
															|  | 
 |  | +		center_on(players)
 | 
												
													
														
															|  | 
 |  | +	else:
 | 
												
													
														
															|  | 
 |  | +		# Show remaining players only
 | 
												
													
														
															|  | 
 |  | +		center_on(living)
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +func center_on(players):
 | 
												
													
														
															|  | 
 |  | +	var position_accumulator = Vector2(0.0, 0.0)
 | 
												
													
														
															|  | 
 |  | +	for p in players:
 | 
												
													
														
															|  |  		position_accumulator += p.position
 |  |  		position_accumulator += p.position
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -	cam.position = position_accumulator / living.size()
 |  | 
 | 
												
													
														
															|  | 
 |  | +	cam.position = position_accumulator / players.size()
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  	var dist = 0
 |  |  	var dist = 0
 | 
												
													
														
															|  | -	for i in range(living.size() - 1):
 |  | 
 | 
												
													
														
															|  | -		for j in range(i + 1, living.size()):
 |  | 
 | 
												
													
														
															|  | -			dist = max(dist, living[i].position.distance_to(living[j].position))
 |  | 
 | 
												
													
														
															|  | 
 |  | +	for i in range(players.size() - 1):
 | 
												
													
														
															|  | 
 |  | +		for j in range(i + 1, players.size()):
 | 
												
													
														
															|  | 
 |  | +			dist = max(dist, players[i].position.distance_to(players[j].position))
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  	# Extend camera zoom if liners are far from each other
 |  |  	# Extend camera zoom if liners are far from each other
 | 
												
													
														
															|  |  	var zoom = 1.0
 |  |  	var zoom = 1.0
 |