-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLabelControl.gd
49 lines (38 loc) · 1.67 KB
/
LabelControl.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
extends Control
#var selected_tile = Vector2.ZERO #setget update_selected_tile
var colnames = ["A", "B", "C", "D", "E", "F"]
onready var label = $TileSelectLabel
onready var select_tilemap = $"../SelectTilemap"
onready var labelSeed = $SeedLabel
onready var treasureLabel = $TreasureLabel
var formatted_tile_label = "Z9"
signal formatted_tile_label_signal
#func update_selected_tile(tile_coords):
# pass
# Update this to return 'no diggable tile' if outside
# of grid
# need to import boundaries from elsewhere
# Also convert columns to A, B, C, D, E
# Called when the node enters the scene tree for the first time.
func _ready():
label.text = "No Diggable Tile Selected"
labelSeed.text = "Seed: " + str(Globals.random_seed_selected)
treasureLabel.text = "Treasure:\n0 pieces"
func _on_SelectTilemap_current_tile_signal(tile_coords):
if tile_coords == Vector2.ZERO:
label.text = "No Diggable Tile Selected"
elif tile_coords[0] > (select_tilemap.GridXStart + select_tilemap.GridSizeX ) or tile_coords[1] > (select_tilemap.GridYStart + select_tilemap.GridSizeY ):
label.text = "No Diggable Tile Selected"
else:
formatted_tile_label = str(colnames[tile_coords[0] - select_tilemap.GridXStart]) + \
str(tile_coords[1] - select_tilemap.GridYStart + 1)
label.text = "Selected Tile = " + formatted_tile_label
emit_signal("formatted_tile_label_signal", formatted_tile_label)
func _on_SelectTilemap_tile_in_diggable_limits(value):
if value == false:
label.text = "No Diggable Tile Selected"
func _on_Player_treasure_found(value):
if value == 1:
treasureLabel.text = "Treasure:\n" + str(value) + " piece"
else:
treasureLabel.text = "Treasure:\n" + str(value) + " pieces"