summaryrefslogtreecommitdiff
path: root/UI/LevelSelect.gd
diff options
context:
space:
mode:
Diffstat (limited to 'UI/LevelSelect.gd')
-rw-r--r--UI/LevelSelect.gd15
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)