diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-06-18 16:43:22 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-06-18 16:43:22 +0200 |
commit | 395c25b1fbe51f42decf402f97e51eabcc8c0a77 (patch) | |
tree | 72a17c71a39b53d328a76e111ae205d9538d64d0 /UI/LevelSelect.gd | |
parent | 2686ec6d4af6b5437a5f5a5cac008f3d38295f78 (diff) |
Godot v3 -> v4
Diffstat (limited to 'UI/LevelSelect.gd')
-rw-r--r-- | UI/LevelSelect.gd | 15 |
1 files changed, 9 insertions, 6 deletions
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) |