add goblin crowd birth control and mute button

This commit is contained in:
fram3d 2024-07-06 03:27:39 +02:00
parent cba448ce24
commit 631f8ef6e7
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
12 changed files with 74 additions and 15 deletions

View File

@ -0,0 +1,3 @@
source_md5="f7fed284858c30704909f39730c337c4"
dest_md5="c2ca7958441b9a8f6f81e5e168d7633f"

View File

@ -1,3 +1,3 @@
source_md5="2184eb3cff7df95cd01dcc9b94756557"
dest_md5="185a0384fd8901adb5c098cb99e4bc0a"
dest_md5="525c313cb5d55d5982762b7de127ec5e"

View File

@ -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")

View File

@ -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"]

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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"]

BIN
src/UI/mute.png (Stored with Git LFS) Normal file

Binary file not shown.

34
src/UI/mute.png.import Normal file
View File

@ -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