From 9888c53d0452b3ef5017b32ed1115f578abda2ad Mon Sep 17 00:00:00 2001 From: copygirl Date: Fri, 16 Apr 2021 18:43:43 +0200 Subject: [PATCH] Fix viewport not moving when paused --- scene/EscapeMenu.tscn | 10 +++++----- scene/LocalPlayer.tscn | 1 + src/Background.cs | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scene/EscapeMenu.tscn b/scene/EscapeMenu.tscn index 00ec551..c53dede 100644 --- a/scene/EscapeMenu.tscn +++ b/scene/EscapeMenu.tscn @@ -79,9 +79,9 @@ ColorSliderPath = NodePath("VBoxContainer/ContainerColor/Hue") [node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Appearance"] margin_left = 19.0 -margin_top = 14.0 +margin_top = 16.0 margin_right = 201.0 -margin_bottom = 72.0 +margin_bottom = 71.0 [node name="ContainerName" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Appearance/VBoxContainer"] margin_right = 182.0 @@ -136,12 +136,12 @@ scrollable = false [node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Appearance/VBoxContainer"] margin_top = 42.0 margin_right = 182.0 -margin_bottom = 57.0 -rect_min_size = Vector2( 0, 15 ) +margin_bottom = 54.0 +rect_min_size = Vector2( 0, 12 ) custom_colors/font_color = Color( 0.6, 0.6, 0.6, 1 ) text = "(Close Menu to apply changes.)" align = 1 -valign = 1 +valign = 2 [node name="Multiplayer" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer"] visible = false diff --git a/scene/LocalPlayer.tscn b/scene/LocalPlayer.tscn index 93240e3..4566770 100644 --- a/scene/LocalPlayer.tscn +++ b/scene/LocalPlayer.tscn @@ -7,4 +7,5 @@ script = ExtResource( 3 ) [node name="Camera" type="Camera2D" parent="." index="0"] +pause_mode = 2 current = true diff --git a/src/Background.cs b/src/Background.cs index 8adf67b..800a0db 100644 --- a/src/Background.cs +++ b/src/Background.cs @@ -7,8 +7,8 @@ public class Background : TextureRect var offset = new Vector2(8, 8); var tileSize = Texture.GetSize(); var viewportSize = GetViewport().Size; - var camera = LocalPlayer.Instance.GetNode("Camera"); - RectPosition = ((camera.GlobalPosition - viewportSize / 2) / tileSize).Floor() * tileSize - offset; + var cameraPos = LocalPlayer.Instance.GetNode("Camera").GetCameraPosition(); + RectPosition = ((cameraPos - viewportSize / 2) / tileSize).Floor() * tileSize - offset; RectSize = ((viewportSize + offset) / tileSize + Vector2.One).Ceil() * tileSize; } }