From 631f8ef6e70b07db8ac1501abe33ba96d42cfa50 Mon Sep 17 00:00:00 2001 From: fram3d Date: Sat, 6 Jul 2024 03:27:39 +0200 Subject: [PATCH] add goblin crowd birth control and mute button --- ...e.png-263cf22b7bdef42d3fc4b17687ab671b.md5 | 3 ++ ....png-263cf22b7bdef42d3fc4b17687ab671b.stex | Bin 0 -> 147 bytes ...n.png-e12305e67719f26568156597e178b74d.md5 | 2 +- ....png-e12305e67719f26568156597e178b74d.stex | Bin 160 -> 160 bytes src/NPCs/femalegoblin.gd | 6 +++- src/NPCs/femalegoblin.tscn | 6 +++- src/NPCs/malegoblin.gd | 5 ++- src/NPCs/pregnantgoblin.png.import | 2 +- src/UI/GUI.gd | 5 +-- src/UI/GUI.tscn | 23 ++++++++---- src/UI/mute.png | 3 ++ src/UI/mute.png.import | 34 ++++++++++++++++++ 12 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 src/.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.md5 create mode 100644 src/.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.stex create mode 100644 src/UI/mute.png create mode 100644 src/UI/mute.png.import diff --git a/src/.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.md5 b/src/.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.md5 new file mode 100644 index 0000000..f875be5 --- /dev/null +++ b/src/.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.md5 @@ -0,0 +1,3 @@ +source_md5="f7fed284858c30704909f39730c337c4" +dest_md5="c2ca7958441b9a8f6f81e5e168d7633f" + diff --git a/src/.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.stex b/src/.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.stex new file mode 100644 index 0000000000000000000000000000000000000000..ed5ca276056e02add452688a6858cefe699cfc37 GIT binary patch literal 147 zcmZ>F2@c_6U|;}Y2oPXr1TxBjIKaEak7F*P|sLHN&c)q^fQN-3=`y8bQhHa1LP?+I}2*>R^mPss22 egVN^=j0_ypxc=!_Otk=NWbkzLb6Mw<&;$SwJ0({D literal 0 HcmV?d00001 diff --git a/src/.import/pregnantgoblin.png-e12305e67719f26568156597e178b74d.md5 b/src/.import/pregnantgoblin.png-e12305e67719f26568156597e178b74d.md5 index 7124d68..08d1d70 100644 --- a/src/.import/pregnantgoblin.png-e12305e67719f26568156597e178b74d.md5 +++ b/src/.import/pregnantgoblin.png-e12305e67719f26568156597e178b74d.md5 @@ -1,3 +1,3 @@ source_md5="2184eb3cff7df95cd01dcc9b94756557" -dest_md5="185a0384fd8901adb5c098cb99e4bc0a" +dest_md5="525c313cb5d55d5982762b7de127ec5e" diff --git a/src/.import/pregnantgoblin.png-e12305e67719f26568156597e178b74d.stex b/src/.import/pregnantgoblin.png-e12305e67719f26568156597e178b74d.stex index 8a8ef6e17b01fd8031f0f62cad3c8a21dd5c6d52..d76bccc406d49cc967e243cb10988e9945f579c4 100644 GIT binary patch delta 21 acmZ3$xPXz@-6c4LgMonogc&CCP6hxjQUk*P delta 21 acmZ3$xPXz@-6c4LgMonogjpu?P6hxjVgttj diff --git a/src/NPCs/femalegoblin.gd b/src/NPCs/femalegoblin.gd index 0f40d54..3d9a274 100644 --- a/src/NPCs/femalegoblin.gd +++ b/src/NPCs/femalegoblin.gd @@ -2,6 +2,7 @@ extends KinematicBody2D onready var pregnancy = 0 onready var age = 0 +onready var crowd = 0 onready var tilesmap = $"/root/World/tilemap" onready var rootnode = get_node("/root/World") @@ -14,6 +15,8 @@ const MOVEMENT_VECTORS = [ ] func _physics_process(_delta): + if crowd > 0: + crowd -= 1 if position != null: if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0: queue_free() @@ -46,7 +49,8 @@ func _on_death_finished(): queue_free() func _on_Romance_area_entered(area): - if area.is_in_group("malegoblin") and pregnancy == 0 and age > 2500: + crowd += 5 + if area.is_in_group("malegoblin") and pregnancy == 0 and age > 2500 and crowd < 20: pregnancy = 1 $goblin.texture = load("res://NPCs/pregnantgoblin.png") diff --git a/src/NPCs/femalegoblin.tscn b/src/NPCs/femalegoblin.tscn index cfbe951..cea87fc 100644 --- a/src/NPCs/femalegoblin.tscn +++ b/src/NPCs/femalegoblin.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://NPCs/femalegoblin.png" type="Texture" id=1] [ext_resource path="res://Audio/Hits/goblininjured.ogg" type="AudioStream" id=2] [ext_resource path="res://NPCs/femalegoblin.gd" type="Script" id=3] +[ext_resource path="res://Audio/Hits/goblinvsgoblin.ogg" type="AudioStream" id=4] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 3.90875, 3.7602 ) @@ -59,6 +60,9 @@ shape = SubResource( 3 ) collision_layer = 128 collision_mask = 128 +[node name="fight" type="AudioStreamPlayer" parent="Romance"] +stream = ExtResource( 4 ) + [node name="CollisionShape2D" type="CollisionShape2D" parent="Romance"] shape = SubResource( 4 ) [connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"] diff --git a/src/NPCs/malegoblin.gd b/src/NPCs/malegoblin.gd index d93e807..c607340 100644 --- a/src/NPCs/malegoblin.gd +++ b/src/NPCs/malegoblin.gd @@ -32,9 +32,8 @@ func _on_death_finished(): queue_free() func _on_Romance_area_entered(area): - if area.is_in_group("malegoblin"): - if randi() % 100 < 20: - $Romance/fight.play() + if randi() % 100 < 1: + $Romance/fight.play() func _on_fight_finished(): queue_free() diff --git a/src/NPCs/pregnantgoblin.png.import b/src/NPCs/pregnantgoblin.png.import index ad0d00e..666e09c 100644 --- a/src/NPCs/pregnantgoblin.png.import +++ b/src/NPCs/pregnantgoblin.png.import @@ -20,7 +20,7 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=true +flags/filter=false flags/mipmaps=false flags/anisotropic=false flags/srgb=2 diff --git a/src/UI/GUI.gd b/src/UI/GUI.gd index 22d7f42..26b99e3 100644 --- a/src/UI/GUI.gd +++ b/src/UI/GUI.gd @@ -18,5 +18,6 @@ func _on_speed_toggled(button_pressed): Engine.time_scale = 1 Engine.iterations_per_second = 5 - - +func _on_mute_toggled(button_pressed): + var bus_idx = AudioServer.get_bus_index("Master") + AudioServer.set_bus_mute(bus_idx, button_pressed) diff --git a/src/UI/GUI.tscn b/src/UI/GUI.tscn index 3c80533..b52cb13 100644 --- a/src/UI/GUI.tscn +++ b/src/UI/GUI.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://UI/pause.png" type="Texture" id=1] [ext_resource path="res://UI/speed.png" type="Texture" id=2] [ext_resource path="res://UI/GUI.gd" type="Script" id=3] +[ext_resource path="res://UI/mute.png" type="Texture" id=4] [node name="GUI" type="CanvasLayer"] pause_mode = 2 @@ -11,7 +12,7 @@ script = ExtResource( 3 ) [node name="HBoxContainer" type="HBoxContainer" parent="."] anchor_left = 1.0 anchor_right = 1.0 -margin_left = -6.0 +margin_left = -8.0 margin_right = 49.0 margin_bottom = 24.0 rect_scale = Vector2( 0.1, 0.1 ) @@ -20,9 +21,18 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="mute" type="Button" parent="HBoxContainer"] +margin_right = 22.0 +margin_bottom = 20.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +toggle_mode = true +icon = ExtResource( 4 ) +flat = true + [node name="pause" type="Button" parent="HBoxContainer"] -margin_left = 2.0 -margin_right = 24.0 +margin_left = 26.0 +margin_right = 48.0 margin_bottom = 20.0 hint_tooltip = "Pause" size_flags_horizontal = 0 @@ -32,8 +42,8 @@ icon = ExtResource( 1 ) flat = true [node name="speed" type="Button" parent="HBoxContainer"] -margin_left = 28.0 -margin_right = 55.0 +margin_left = 52.0 +margin_right = 79.0 margin_bottom = 20.0 hint_tooltip = "Double speed" size_flags_horizontal = 0 @@ -41,5 +51,6 @@ size_flags_vertical = 0 toggle_mode = true icon = ExtResource( 2 ) flat = true +[connection signal="toggled" from="HBoxContainer/mute" to="." method="_on_mute_toggled"] [connection signal="toggled" from="HBoxContainer/pause" to="." method="_on_pause_toggled"] [connection signal="toggled" from="HBoxContainer/speed" to="." method="_on_speed_toggled"] diff --git a/src/UI/mute.png b/src/UI/mute.png new file mode 100644 index 0000000..f100ca2 --- /dev/null +++ b/src/UI/mute.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c967e7cd210de67726ff247e9f285799e2e30a081f6a707e382e69161066dfc +size 4760 diff --git a/src/UI/mute.png.import b/src/UI/mute.png.import new file mode 100644 index 0000000..afc6d80 --- /dev/null +++ b/src/UI/mute.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/mute.png" +dest_files=[ "res://.import/mute.png-263cf22b7bdef42d3fc4b17687ab671b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0