diff options
-rw-r--r-- | main_scene/management.tscn | 19 | ||||
-rw-r--r-- | project.godot | 6 | ||||
-rw-r--r-- | save_state.gd | 6 | ||||
-rw-r--r-- | tutorial/intro.gd | 4 | ||||
-rw-r--r-- | tutorial/popup.gd | 25 | ||||
-rw-r--r-- | tutorial/popup.tscn | 15 |
6 files changed, 74 insertions, 1 deletions
diff --git a/main_scene/management.tscn b/main_scene/management.tscn index 58c4935..50681e5 100644 --- a/main_scene/management.tscn +++ b/main_scene/management.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://assets/background.png" type="Texture" id=1] [ext_resource path="res://main_scene/coffee_machine.gd" type="Script" id=2] @@ -9,6 +9,8 @@ [ext_resource path="res://lib/base_buyable.gd" type="Script" id=7] [ext_resource path="res://assets/coffee_maschine.png" type="Texture" id=8] [ext_resource path="res://upgrades/upgrades.tscn" type="PackedScene" id=9] +[ext_resource path="res://tutorial/popup.tscn" type="PackedScene" id=10] +[ext_resource path="res://tutorial/intro.gd" type="Script" id=11] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 360, 360 ) @@ -61,3 +63,18 @@ script = ExtResource( 7 ) position = Vector2( -0.0478821, -0.59053 ) scale = Vector2( 0.174159, 0.186657 ) shape = SubResource( 2 ) + +[node name="intro" parent="." instance=ExtResource( 10 )] +margin_left = 347.916 +margin_top = 183.211 +margin_right = 713.916 +margin_bottom = 282.211 +text = "This is coffee clicker! You are trying to keep your +I.T. department alive, and for that you need to provide +them with the most vital resource: Coffee. +Start by clicking the coffee machine to brew some coffee. + +(Click this text to close it)" +align = 1 +script = ExtResource( 11 ) +identifier = "introduction" diff --git a/project.godot b/project.godot index ba959f0..15c6824 100644 --- a/project.godot +++ b/project.godot @@ -39,6 +39,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://lib/ticked.gd" }, { +"base": "Label", +"class": "TutorialPopup", +"language": "GDScript", +"path": "res://tutorial/popup.gd" +}, { "base": "BuildingInterface", "class": "UpgradeInterface", "language": "GDScript", @@ -51,6 +56,7 @@ _global_script_class_icons={ "ClickableArea": "", "Manager": "", "Ticked": "", +"TutorialPopup": "", "UpgradeInterface": "" } diff --git a/save_state.gd b/save_state.gd index edd6ed5..2e54d6c 100644 --- a/save_state.gd +++ b/save_state.gd @@ -54,4 +54,10 @@ func pack_data(): "coffee_beans": coffee_beans, "bitcoin": bitcoin, "riot_cooldown": riot_cooldown, + "tutorial": tutorial, } + +var tutorial = { + "introduction": false, +} + diff --git a/tutorial/intro.gd b/tutorial/intro.gd new file mode 100644 index 0000000..3de468b --- /dev/null +++ b/tutorial/intro.gd @@ -0,0 +1,4 @@ +extends TutorialPopup + +func _trigger(): + return true diff --git a/tutorial/popup.gd b/tutorial/popup.gd new file mode 100644 index 0000000..1d4c59c --- /dev/null +++ b/tutorial/popup.gd @@ -0,0 +1,25 @@ +extends Label +class_name TutorialPopup + +export var identifier = "" + +func _input(event): + if not is_visible_in_tree(): + return + if event is InputEventMouseButton: + if event.pressed and event.button_index == BUTTON_LEFT: + SaveState.tutorial[identifier] = true + hide() + get_tree().paused = false + +func _trigger() -> bool: + return false +func _ready(): + hide() # like the goblin you are + +func _process(delta): + if SaveState.tutorial[identifier]: + return + if _trigger(): + show() + get_tree().paused = true diff --git a/tutorial/popup.tscn b/tutorial/popup.tscn new file mode 100644 index 0000000..aab4ddc --- /dev/null +++ b/tutorial/popup.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://tutorial/popup.gd" type="Script" id=1] + +[sub_resource type="StyleBoxFlat" id=1] +bg_color = Color( 0.6, 0.933333, 0.847059, 1 ) + +[node name="Node2D" type="Label"] +pause_mode = 2 +custom_styles/normal = SubResource( 1 ) +custom_colors/font_color = Color( 0, 0, 0, 1 ) +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} |