aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--godot/scenes/Die.gd12
-rw-r--r--godot/scenes/Game.gd9
2 files changed, 21 insertions, 0 deletions
diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd
index 5e238f1..407f248 100644
--- a/godot/scenes/Die.gd
+++ b/godot/scenes/Die.gd
@@ -1,5 +1,7 @@
extends Spatial
+const Game = preload("res://scenes/Game.gd")
+
var camrot_h = 0
var camrot_v = 0
var camrot_v_locked_val = 0
@@ -12,14 +14,24 @@ var dragging = false
var mouse_origin = Vector2(0,0)
var dice_launch_force = 0
+var _game: Game = null
+
# Called when the node enters the scene tree for the first time.
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
$CamRoot/Horizontal/Vertical/Camera.add_exception(self)
$CamRoot.set_as_toplevel(true)
+ _game = get_node("/root/Game")
func _input(event):
+ if event is InputEventKey:
+ if event.scancode == KEY_TAB:
+ if event.is_pressed():
+ _game.open_scoreboard()
+ else:
+ _game.close_scoreboard()
+
if event is InputEventMouseMotion:
camrot_h += -event.relative.x * sensitivity
camrot_v += -event.relative.y * sensitivity
diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd
index 29a5537..56acb04 100644
--- a/godot/scenes/Game.gd
+++ b/godot/scenes/Game.gd
@@ -66,3 +66,12 @@ func add_stroke():
func revoke_stroke():
current_strokes -= 1
+
+
+func open_scoreboard():
+ $Scoreboard.update_values(strokes_per_level, PAR)
+ $Scoreboard.show()
+
+
+func close_scoreboard():
+ $Scoreboard.hide()