From 395c25b1fbe51f42decf402f97e51eabcc8c0a77 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 18 Jun 2023 16:43:22 +0200 Subject: Godot v3 -> v4 --- UI/LevelSelect.gd | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'UI/LevelSelect.gd') diff --git a/UI/LevelSelect.gd b/UI/LevelSelect.gd index 2d40a36..368d338 100644 --- a/UI/LevelSelect.gd +++ b/UI/LevelSelect.gd @@ -2,7 +2,7 @@ extends Control func _ready(): - Global.connect("level_map_updated", self, "draw") + Global.connect("level_map_updated", Callable(self, "draw")) draw() @@ -10,14 +10,17 @@ func draw(): var Cell = load("res://UI/LevelSelectCell.tscn") for idx in range(Global.Level_Map.size()): # size = 9 - var cell = Cell.instance() + var cell = Cell.instantiate() cell.level_idx = idx - cell.set_rect_size(1024/3, 600/3) + cell.set_rect_size( + get_viewport_rect().size.x/3, + get_viewport_rect().size.y/3 + ) var column = idx % 3 var row = idx / 3 - cell.rect_position.x = cell.rect_size.x*column - cell.rect_position.y = cell.rect_size.y*row - cell.connect("gui_input", self, '_button_pressed', [idx]) + cell.position.x = cell.size.x*column + cell.position.y = cell.size.y*row + cell.connect("gui_input", Callable(self, '_button_pressed').bind(idx)) self.add_child(cell) -- cgit v1.2.3