diff options
Diffstat (limited to 'Levels/Level.gd')
-rw-r--r-- | Levels/Level.gd | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Levels/Level.gd b/Levels/Level.gd index d7ea0c9..0706b0b 100644 --- a/Levels/Level.gd +++ b/Levels/Level.gd @@ -12,6 +12,7 @@ var CancelButton = preload("res://UI/HUD/CancelButton.tscn").instantiate() func _ready(): self.set_hud() + get_tree().get_root().size_changed.connect(Callable(self, 'resize_hud')) var character = load("res://Characters/" + Network.player.character + ".tscn").instantiate() self.set_player(character) @@ -28,17 +29,20 @@ func _input(event): func set_hud(): + self.HUD.add_child(self.LabelTimer) + self.HUD.add_child(self.LevelMap) + self.HUD.add_child(self.CancelButton) + self.add_child(self.HUD) + + self.resize_hud() + +func resize_hud(): self.LabelTimer.position.x = 3 self.LevelMap.position.x = get_viewport_rect().end.x - self.LevelMap.size.x self.CancelButton.position.x = get_viewport_rect().end.x - self.CancelButton.size.x self.CancelButton.position.y = get_viewport_rect().end.y - self.CancelButton.size.y - - self.HUD.add_child(self.LabelTimer) - self.HUD.add_child(self.LevelMap) - self.HUD.add_child(self.CancelButton) - self.add_child(self.HUD) func set_player(character: CharacterBody2D): |