diff --git a/currency/currency.gd b/currency/currency.gd index aa3d55e..1ed9b57 100644 --- a/currency/currency.gd +++ b/currency/currency.gd @@ -8,3 +8,4 @@ class_name Currency @export var color: Color = Color.PINK @export var wants: Array[Production] @export var commands: Array[Command] = [preload("res://commands/move_command.tres")] +@export var soldier: bool diff --git a/currency/members/member_sprite.gd b/currency/members/member_sprite.gd index 2c3cd57..cc2deb3 100644 --- a/currency/members/member_sprite.gd +++ b/currency/members/member_sprite.gd @@ -25,3 +25,6 @@ func _input(event: InputEvent) -> void: func get_allegiance(): return allegiance.kingdom_name + +func get_combat(): + return currency.soldier diff --git a/currency/sentient/archer.tres b/currency/sentient/archer.tres index 6ff9ae0..8ad675c 100644 --- a/currency/sentient/archer.tres +++ b/currency/sentient/archer.tres @@ -49,4 +49,5 @@ production = Array[ExtResource("1_m37xt")]([ExtResource("2_b0duy"), ExtResource( description = "arrow go fweeewww" color = Color(1.1310726e-06, 0.67725253, 0.15828604, 1) wants = Array[ExtResource("1_m37xt")]([SubResource("Resource_ui157"), SubResource("Resource_ah5vq"), SubResource("Resource_2437s"), SubResource("Resource_n5gpp"), SubResource("Resource_b1lqu")]) +soldier = true metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/calvary.tres b/currency/sentient/calvary.tres index ee61a95..6fea5c3 100644 --- a/currency/sentient/calvary.tres +++ b/currency/sentient/calvary.tres @@ -49,4 +49,5 @@ production = Array[ExtResource("1_cnnt2")]([ExtResource("2_hqcau"), ExtResource( description = "save a horse ride a cowboy or something." color = Color(1, 0.14509805, 0.08627451, 1) wants = Array[ExtResource("1_cnnt2")]([SubResource("Resource_ui157"), SubResource("Resource_ah5vq"), SubResource("Resource_2437s"), SubResource("Resource_n5gpp"), SubResource("Resource_b1lqu")]) +soldier = true metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/dinosaur.tres b/currency/sentient/dinosaur.tres index fa6d0f0..f4f2094 100644 --- a/currency/sentient/dinosaur.tres +++ b/currency/sentient/dinosaur.tres @@ -110,5 +110,7 @@ name = "Dinosaur" description = "*rawrs at you gayly and prehistorically*" thumbnail = ExtResource("3_bufop") color = Color(1, 0.48235294, 0, 1) -wants = Array[ExtResource("1_qayfp")]([SubResource("Resource_unbv5"), SubResource("Resource_awlnm"), SubResource("Resource_jihtj"), SubResource("Resource_utj6b"), SubResource("Resource_hi66y"), SubResource("Resource_mf31s"), SubResource("Resource_gdovn"), SubResource("Resource_ts66k"), SubResource("Resource_gt1pn"), SubResource("Resource_evrxh"), SubResource("Resource_b1bj4"), SubResource("Resource_mjehd"), SubResource("Resource_c4cgt"), SubResource("Resource_n7bnc")]) + +wants = Array[ExtResource("1_qayfp")]([SubResource("Resource_unbv5"), SubResource("Resource_awlnm"), SubResource("Resource_jihtj"), SubResource("Resource_utj6b"), SubResource("Resource_2b5sm"), SubResource("Resource_yq4u0"), SubResource("Resource_hi66y"), SubResource("Resource_mf31s"), SubResource("Resource_gdovn"), SubResource("Resource_ts66k"), SubResource("Resource_gt1pn"), SubResource("Resource_evrxh"), SubResource("Resource_b1bj4"), SubResource("Resource_mjehd"), SubResource("Resource_c6wya"), SubResource("Resource_c4cgt"), SubResource("Resource_n7bnc")]) +soldier = true metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/kings_guard.tres b/currency/sentient/kings_guard.tres index fe27731..3177240 100644 --- a/currency/sentient/kings_guard.tres +++ b/currency/sentient/kings_guard.tres @@ -42,4 +42,5 @@ production = Array[ExtResource("1_f1fuf")]([ExtResource("2_s3h3i"), ExtResource( description = "better hope these guys are loyal." color = Color(0.54509807, 0, 1, 1) wants = Array[ExtResource("1_f1fuf")]([SubResource("Resource_1g3kj"), SubResource("Resource_kmdkm"), SubResource("Resource_3p8gt"), SubResource("Resource_m16xj")]) +soldier = true metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/knight.tres b/currency/sentient/knight.tres index 5efbfb7..52d42ce 100644 --- a/currency/sentient/knight.tres +++ b/currency/sentient/knight.tres @@ -35,4 +35,5 @@ production = Array[ExtResource("1_626vc")]([ExtResource("2_sa77c"), ExtResource( description = "Nighty night Knight" color = Color(0.54901963, 0, 0, 1) wants = Array[ExtResource("1_626vc")]([SubResource("Resource_ui157"), SubResource("Resource_ah5vq"), SubResource("Resource_2437s")]) +soldier = true metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/mercenary.tres b/currency/sentient/mercenary.tres index 53a9e9a..06a4d34 100644 --- a/currency/sentient/mercenary.tres +++ b/currency/sentient/mercenary.tres @@ -21,4 +21,5 @@ production = Array[ExtResource("1_81xhi")]([ExtResource("2_x1puw"), ExtResource( description = "For some reason I always think of masonry when I read this word." color = Color(0.36862746, 0.3019608, 0.7529412, 1) wants = Array[ExtResource("1_81xhi")]([SubResource("Resource_3og8x")]) +soldier = true metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/wizard.tres b/currency/sentient/wizard.tres index 437e67c..0a1ff9e 100644 --- a/currency/sentient/wizard.tres +++ b/currency/sentient/wizard.tres @@ -69,4 +69,5 @@ production = Array[ExtResource("1_05kyk")]([ExtResource("2_ud150"), ExtResource( description = "FIREBALL!!!" color = Color(0, 0, 0.79607844, 1) wants = Array[ExtResource("1_05kyk")]([SubResource("Resource_60ga3"), SubResource("Resource_i5jpd"), SubResource("Resource_2l2nr"), SubResource("Resource_6v7ae"), SubResource("Resource_iph2q"), SubResource("Resource_i8tft"), SubResource("Resource_j0xkl")]) +soldier = true metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/economy.gd b/economy.gd index 075095b..1f23f68 100644 --- a/economy.gd +++ b/economy.gd @@ -3,6 +3,7 @@ extends Node signal productions_update(p: Array[Production]) @warning_ignore("unused_signal") signal production_log(producer: Currency, p: Production) +@warning_ignore("unused_signal") signal log(s: String) @export var currencies: Array[Production] @export var members: Array @@ -65,6 +66,7 @@ func produce(production: Production): sync_currency.call_deferred() var c := get_currency(production.currency) c.amount += production.amount + c.amount = clamp(c.amount, 0, 9999) func update_currencies(): productions_update.emit.call_deferred(currencies) @@ -79,6 +81,10 @@ func simulate(): update_currencies() for e in events: if e.requirements_satisfied() and e.will_happen(): + if e.game_over_timeline != null: + get_tree().change_scene_to_file("res://game_over.tscn") + Dialogic.start(e.game_over_timeline) + return if e.log_message != "" and not e.skip_log: Economy.log.emit(e.log_message) var outcome := e.outcome() @@ -111,8 +117,12 @@ func get_all_inanimate_currencies() -> Array: func _ready() -> void: %SimulateTickTimer.start() update_currencies() + log.emit.call_deferred("Welcome to your kingdom!") func _on_timer_timeout() -> void: + if get_tree().current_scene.scene_file_path != "res://game.tscn": + %SimulateTickTimer.start() + return if Dialogic.current_timeline != null: %SimulateTickTimer.start() return diff --git a/game_over.gd b/game_over.gd new file mode 100644 index 0000000..070e3a8 --- /dev/null +++ b/game_over.gd @@ -0,0 +1,6 @@ +extends Control + + +func _ready() -> void: + await Dialogic.timeline_ended + get_tree().quit() diff --git a/game_over.gd.uid b/game_over.gd.uid new file mode 100644 index 0000000..02ba99f --- /dev/null +++ b/game_over.gd.uid @@ -0,0 +1 @@ +uid://newnma6kkptj diff --git a/game_over.tscn b/game_over.tscn new file mode 100644 index 0000000..19e6097 --- /dev/null +++ b/game_over.tscn @@ -0,0 +1,21 @@ +[gd_scene format=3 uid="uid://cqfexy3yy3tbr"] + +[ext_resource type="Script" uid="uid://newnma6kkptj" path="res://game_over.gd" id="1_y26ei"] + +[node name="GameOver" type="Control" unique_id=880250183] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_y26ei") + +[node name="ColorRect" type="ColorRect" parent="." unique_id=619694373] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 1) diff --git a/map.tscn b/map.tscn index aafd3ff..0639dc7 100644 --- a/map.tscn +++ b/map.tscn @@ -7,7 +7,6 @@ [ext_resource type="Resource" uid="uid://dlxnbyiurne1s" path="res://currency/sentient/calvary.tres" id="4_iw27f"] [ext_resource type="Resource" uid="uid://b7lxfjhx4qhts" path="res://allegiance/good.tres" id="5_71pa8"] [ext_resource type="Resource" uid="uid://dn0c1pfq04obw" path="res://currency/sentient/farmer.tres" id="6_05x41"] -[ext_resource type="Resource" uid="uid://l8osuuxl7exe" path="res://currency/sentient/archer.tres" id="8_oysan"] [ext_resource type="Resource" uid="uid://clx8tbrad4m7c" path="res://currency/sentient/dinosaur.tres" id="9_sb2pt"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_bhunq"] @@ -180,6 +179,7 @@ allegiance = ExtResource("5_71pa8") position = Vector2(905, 42) [node name="MemberSprite" parent="CharacterBody2D3" index="1" unique_id=283117283] +currency = ExtResource("9_sb2pt") allegiance = ExtResource("5_71pa8") [node name="CharacterBody2D4" parent="." unique_id=327546409 instance=ExtResource("3_e0an3")] @@ -245,7 +245,7 @@ currency = ExtResource("6_05x41") position = Vector2(853, -17.999998) [node name="MemberSprite" parent="CharacterBody2D12" index="1" unique_id=283117283] -currency = ExtResource("8_oysan") +currency = ExtResource("9_sb2pt") [node name="CharacterBody2D13" parent="." unique_id=799583982 instance=ExtResource("3_e0an3")] position = Vector2(905.99994, -11.999985) diff --git a/start_screen.gd b/start_screen.gd new file mode 100644 index 0000000..e33ded2 --- /dev/null +++ b/start_screen.gd @@ -0,0 +1,10 @@ +extends Control + +func _on_button_pressed() -> void: + Dialogic.start(preload("res://test/timeline.dtl")) + await Dialogic.timeline_ended + get_tree().change_scene_to_file("res://game.tscn") + + +func _on_button_2_pressed() -> void: + get_tree().change_scene_to_file("res://game.tscn") diff --git a/start_screen.gd.uid b/start_screen.gd.uid new file mode 100644 index 0000000..62251cc --- /dev/null +++ b/start_screen.gd.uid @@ -0,0 +1 @@ +uid://qt8u20vettgk diff --git a/start_screen.tscn b/start_screen.tscn new file mode 100644 index 0000000..7128959 --- /dev/null +++ b/start_screen.tscn @@ -0,0 +1,59 @@ +[gd_scene format=3 uid="uid://d1hx10534r452"] + +[ext_resource type="Script" uid="uid://qt8u20vettgk" path="res://start_screen.gd" id="1_ncxyx"] + +[node name="StartScreen" type="Control" unique_id=637740603] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_ncxyx") + +[node name="ColorRect" type="ColorRect" parent="." unique_id=490588497] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 1) + +[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=384868949] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -54.0 +offset_top = -71.0 +offset_right = 54.0 +offset_bottom = -31.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="Button" type="Button" parent="HBoxContainer" unique_id=1726767847] +layout_mode = 2 +text = "Play Game" + +[node name="Button2" type="Button" parent="HBoxContainer" unique_id=783169397] +layout_mode = 2 +text = "Skip Intro" + +[node name="Label" type="Label" parent="." unique_id=380038515] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -481.0 +offset_top = 77.0 +offset_right = 482.0 +offset_bottom = 169.0 +grow_horizontal = 2 +theme_override_font_sizes/font_size = 72 +text = "For King and Currency" + +[connection signal="pressed" from="HBoxContainer/Button" to="." method="_on_button_pressed"] +[connection signal="pressed" from="HBoxContainer/Button2" to="." method="_on_button_2_pressed"] diff --git a/troup.gd b/troup.gd index d2586f4..517b6d6 100644 --- a/troup.gd +++ b/troup.gd @@ -21,8 +21,18 @@ func removed_target(): target = null func combat(target): + if get_node("MemberSprite").get_combat() == false: + var p := Production.new() + p.amount = -1 + p.currency = %MemberSprite.currency + Economy.produce(p) + self.queue_free() + return var winner = randf_range(0,2) - print(winner) + if %MemberSprite.currency.name == "Dinosaur" or %MemberSprite.currency.name == "Wizard": + winner -= 0.5 + if target.get_node("MemberSprite").currency.name == "Dinosaur" or target.get_node("MemberSprite").currency.name == "Wizard": + winner += 0.5 if winner <= 1: target.queue_free() else: @@ -30,7 +40,7 @@ func combat(target): p.amount = -1 p.currency = %MemberSprite.currency Economy.produce(p) - + Economy.log.emit("A " + p.currency.name +" died in combat!") self.queue_free() #func _Direction() -> Vector2: