diff --git a/World/Map.gd b/World/Map.gd index 1cd1e48..c3a91c5 100644 --- a/World/Map.gd +++ b/World/Map.gd @@ -96,6 +96,11 @@ func parse_map_file(file_name): print("Map data or dimensions missing") func apply_options(): -# $"Map boundaries/CollisionShape2D".shape.size = 64 * Vector2i(width, height) -# $"Map boundaries".position = 64 * Vector2i(width, height) - pass + if MapConfig.edgewrap: + $"../Map boundaries/CollisionShape2D".shape.size = 64 * Vector2i(MapConfig.mapwidth, MapConfig.mapheight) + $"../Map boundaries".position = 64 * Vector2i(MapConfig.mapwidth, MapConfig.mapheight) + if not $"../Map boundaries".is_connected("body_exited", $".."._on_map_boundaries_body_exited): + $"../Map boundaries".connect("body_exited", $".."._on_map_boundaries_body_exited) + else: + if $"../Map boundaries".is_connected("body_exited", $".."._on_map_boundaries_body_exited): + $"../Map boundaries".disconnect("body_exited", $".."._on_map_boundaries_body_exited) diff --git a/World/PlayingField.tscn b/World/PlayingField.tscn index 4fba8eb..d59f204 100644 --- a/World/PlayingField.tscn +++ b/World/PlayingField.tscn @@ -182,5 +182,3 @@ shape = SubResource("RectangleShape2D_hjo0t") _spawnable_scenes = PackedStringArray("res://World/PlayerShip.tscn") spawn_path = NodePath("../Players") spawn_limit = 4 - -[connection signal="body_exited" from="Map boundaries" to="." method="_on_map_boundaries_body_exited"]