Fix egdewrapping

This commit is contained in:
DeathByDenim 2023-05-22 14:57:42 -04:00
parent e44fc0ee09
commit 539982ef10
Signed by: DeathByDenim
GPG Key ID: 4A475283D925365B
2 changed files with 8 additions and 5 deletions

View File

@ -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)

View File

@ -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"]