summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Levels/Level.gd2
-rw-r--r--UI/HUD/CancelButton.gd5
-rw-r--r--UI/HUD/CancelButton.tscn28
3 files changed, 35 insertions, 0 deletions
diff --git a/Levels/Level.gd b/Levels/Level.gd
index 7544dd9..6777854 100644
--- a/Levels/Level.gd
+++ b/Levels/Level.gd
@@ -7,11 +7,13 @@ var timer = 0
var HUD = CanvasLayer.new()
var LabelTimer = preload("res://UI/HUD/Timer.tscn").instance()
var LevelMap = preload("res://UI/HUD/LevelMap.tscn").instance()
+var CancelButton = preload("res://UI/HUD/CancelButton.tscn").instance()
func _ready():
self.HUD.add_child(self.LabelTimer)
self.HUD.add_child(self.LevelMap)
+ self.HUD.add_child(self.CancelButton)
self.add_child(self.HUD)
var character = load("res://Characters/" + Network.player.character + ".tscn").instance()
diff --git a/UI/HUD/CancelButton.gd b/UI/HUD/CancelButton.gd
new file mode 100644
index 0000000..51b146b
--- /dev/null
+++ b/UI/HUD/CancelButton.gd
@@ -0,0 +1,5 @@
+extends Button
+
+
+func _on_CancelButton_pressed():
+ Global.cancel_level()
diff --git a/UI/HUD/CancelButton.tscn b/UI/HUD/CancelButton.tscn
new file mode 100644
index 0000000..27441cb
--- /dev/null
+++ b/UI/HUD/CancelButton.tscn
@@ -0,0 +1,28 @@
+[gd_scene load_steps=4 format=2]
+
+[ext_resource path="res://UI/HUD/CancelButton.gd" type="Script" id=1]
+
+[sub_resource type="StyleBoxFlat" id=2]
+bg_color = Color( 0, 0, 0, 1 )
+
+[sub_resource type="StyleBoxFlat" id=1]
+bg_color = Color( 0.6, 0.6, 0.6, 0 )
+border_width_left = 1
+border_width_top = 1
+border_width_right = 1
+border_width_bottom = 1
+border_color = Color( 0, 0, 0, 1 )
+
+[node name="CancelButton" type="Button"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_top = 576.0
+margin_right = -960.0
+custom_styles/hover = SubResource( 2 )
+custom_styles/normal = SubResource( 1 )
+text = "Cancel"
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+[connection signal="pressed" from="." to="." method="_on_CancelButton_pressed"]