Merge remote-tracking branch 'origin/main' into joke-processing

This commit is contained in:
Waldemar Tomme 2024-01-27 17:11:58 +01:00
commit 51546337ce
7 changed files with 114 additions and 32 deletions

View File

@ -10,7 +10,7 @@ func _ready():
var person_node = person.instantiate()
person_node.color = AudienceMember.get_random_color()
seat.add_child(person_node)
counter += 1
if counter == max_persons:
break

View File

@ -84,6 +84,10 @@ func _process(delta):
mood -= profile.happiness_decay * delta
elif mood < profile.lashout_threshold * .9:
mood += profile.lashout_decay * delta
if mood < profile.lashout_threshold:
throw_bottle()
update_expression()
@ -134,3 +138,11 @@ func set_random_face():
func on_joke(joke: Joke):
var mood_change = profile.joke_mood_mapping.get(joke.type, 0)
update_mood(mood_change)
func throw_bottle():
mood += 2.0
var bottle_scene = preload("res://scenes/objects/bottle.tscn")
var bottle = bottle_scene.instantiate()
add_child(bottle);

View File

@ -30,8 +30,8 @@ script = ExtResource("2_bsodr")
happy_threshold = 3.0
angry_threshold = -3.0
lashout_threshold = -10.0
happiness_decay = 1.0
lashout_decay = 10.0
happiness_decay = 0.1
lashout_decay = 0.1
joke_mood_mapping = {
0: 1.0,
1: 0.0,

View File

@ -0,0 +1,31 @@
extends Sprite2D
@export var bottle_speed: float = 120;
var tim_global_position: Vector2
var is_hidding: bool
# Called when the node enters the scene tree for the first time.
func _ready():
tim_global_position = get_node("/root/IngameScene/Stage/Tim/ThrowPoint").global_position
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var t = create_tween()
t.tween_property(self, "global_position", tim_global_position, 3.0)
t.tween_callback(remove_bottle)
func _on_bottle_area_entered(area):
is_hidding = true
func _on_bottle_area_exited(area):
is_hidding = false
func _on_growth_timer_timeout():
var t = create_tween()
t.tween_property(self, "scale", self.scale + Vector2(0.01, 0.01), 0.02)
func remove_bottle():
if is_hidding:
print("Ouch")
queue_free()

View File

@ -0,0 +1,30 @@
[gd_scene load_steps=4 format=3 uid="uid://c5f5v1wtottyp"]
[ext_resource type="Script" path="res://scenes/objects/bottle.gd" id="1_87ktq"]
[ext_resource type="Texture2D" uid="uid://bavsg3hu7pccy" path="res://sprites/room/bottle.svg" id="1_uea7l"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_p8qcj"]
radius = 22.4893
height = 44.9786
[node name="BottleSprite" type="Sprite2D"]
z_index = 50
scale = Vector2(0.25, 0.25)
texture = ExtResource("1_uea7l")
script = ExtResource("1_87ktq")
[node name="GrowthTimer" type="Timer" parent="."]
wait_time = 0.1
autostart = true
[node name="Bottle" type="Area2D" parent="."]
collision_layer = 4096
[node name="CollisionShape2D" type="CollisionShape2D" parent="Bottle"]
rotation = 0.487459
scale = Vector2(1, 2.66666)
shape = SubResource("CapsuleShape2D_p8qcj")
[connection signal="timeout" from="GrowthTimer" to="." method="_on_growth_timer_timeout"]
[connection signal="area_entered" from="Bottle" to="." method="_on_bottle_area_entered"]
[connection signal="area_exited" from="Bottle" to="." method="_on_bottle_area_exited"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://cicyfp5xjvvu4"]
[gd_scene load_steps=8 format=3 uid="uid://cicyfp5xjvvu4"]
[ext_resource type="Script" path="res://scenes/Tim.gd" id="1_g3k2b"]
[ext_resource type="Texture2D" uid="uid://kq63ictuirhc" path="res://sprites/tim_side.png" id="1_saxit"]
@ -8,6 +8,9 @@
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_3hx6l"]
size = Vector2(600, 200)
[sub_resource type="CircleShape2D" id="CircleShape2D_4pu36"]
radius = 33.0151
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wmfel"]
size = Vector2(250, 10000)
@ -26,6 +29,12 @@ boundary = NodePath("../Boundary")
tim_sprite = NodePath("Sprite2D")
transmitter_area = NodePath("Joke Transmitter/Area2D")
[node name="ThrowPoint" type="Area2D" parent="Tim"]
position = Vector2(0, -151)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Tim/ThrowPoint"]
shape = SubResource("CircleShape2D_4pu36")
[node name="Sprite2D" type="Sprite2D" parent="Tim"]
z_index = 110
position = Vector2(-12, -142)

File diff suppressed because one or more lines are too long