Merge remote-tracking branch 'remotes/origin/main' into clean_bloat

This commit is contained in:
Mikhail Aristov 2024-01-28 13:50:04 +01:00
commit c03040184e
9 changed files with 157 additions and 31 deletions

View File

@ -3,16 +3,20 @@ extends Node2D
@export var width = 200. @export var width = 200.
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta): func _process(_delta):
pass pass
func get_most_left_position(): func get_most_left_position():
return global_position.x - width / 2 return global_position.x - width / 2
func get_most_right_position(): func get_most_right_position():
return global_position.x + width / 2 return global_position.x + width / 2

View File

@ -44,7 +44,7 @@ func _on_joke_button_button_pressed(joke: Joke):
last_joke = joke last_joke = joke
stamina -= joke.required_stamina stamina -= joke.required_stamina
_disable_buttons() _disable_buttons()
_start_joke_for_audience(false) _start_joke_for_audience()
$AnimationPlayer.play("talking") $AnimationPlayer.play("talking")
func _get_targeted_audience_members(target_all: bool): func _get_targeted_audience_members(target_all: bool):
@ -65,13 +65,17 @@ func _get_targeted_audience_members_in_target_area() -> Array[AudienceMember]:
arr.append(person) arr.append(person)
return arr return arr
func _start_joke_for_audience(target_all: bool): func _start_joke_for_audience():
for person in _get_targeted_audience_members(target_all): for person in _get_targeted_audience_members(true):
person.on_joke_start() person.on_joke_start()
func _finish_joke_for_audience(joke: Joke, target_all: bool): func _tell_joke_for_audience(joke: Joke, target_all: bool):
for person in _get_targeted_audience_members(target_all): for person in _get_targeted_audience_members(target_all):
person.on_joke_finish(joke) person.on_hear_joke(joke)
func _finish_joke_for_audience():
for person in _get_targeted_audience_members(true):
person.on_joke_finish()
func _on_stamina_empty(): func _on_stamina_empty():
get_node("../DisplayGUI").visible = false get_node("../DisplayGUI").visible = false
@ -92,13 +96,15 @@ func _on_stamina_empty():
func ouch(): func ouch():
$Sprite2D.texture = ducking_texture $Sprite2D.texture = ducking_texture
_start_joke_for_audience(true) _start_joke_for_audience()
await get_tree().create_timer(1).timeout await get_tree().create_timer(1).timeout
$Sprite2D.texture = default_texture $Sprite2D.texture = default_texture
_finish_joke_for_audience(Joke.get_bottle_joke(), true) _tell_joke_for_audience(Joke.get_bottle_joke(), true)
_finish_joke_for_audience()
func _on_animation_player_animation_finished(anim_name): func _on_animation_player_animation_finished(anim_name):
_finish_joke_for_audience(last_joke, false) _tell_joke_for_audience(last_joke, false)
_finish_joke_for_audience()
if stamina <= 0: if stamina <= 0:
_on_stamina_empty() _on_stamina_empty()
else: else:

View File

@ -10,27 +10,35 @@ extends Control
@onready var control = %NodeContainer @onready var control = %NodeContainer
@onready var instance: Node2D = node.instantiate() @onready var instance: Node2D = node.instantiate()
func _ready(): func _ready():
instance.modulate.a = 0.0 instance.modulate.a = 0.0
control.add_child(instance) control.add_child(instance)
var tween = create_tween() var tween = create_tween()
tween.set_trans(Tween.TRANS_CUBIC) tween.set_trans(Tween.TRANS_CUBIC)
tween.set_ease(Tween.EASE_IN) tween.set_ease(Tween.EASE_IN)
tween.tween_property(instance, "modulate:a", 1.0, fade_duration)\ tween.tween_property(instance, "modulate:a", 1.0, fade_duration).from(0.0).finished.connect(
.from(0.0)\ _fade_out
.finished.connect(_fade_out) )
func _process(_delta): func _process(_delta):
if interuptable and Input.is_action_just_pressed("exit"): if interuptable and Input.is_action_just_pressed("exit"):
_change_scene() _change_scene()
func _fade_out(): func _fade_out():
var tween = create_tween() var tween = create_tween()
tween.set_trans(Tween.TRANS_CUBIC) tween.set_trans(Tween.TRANS_CUBIC)
tween.set_ease(Tween.EASE_IN) tween.set_ease(Tween.EASE_IN)
tween.tween_property(instance, "modulate:a", 0.0, fade_duration)\ (
.set_delay(stay_duration)\ tween
.finished.connect(_change_scene) . tween_property(instance, "modulate:a", 0.0, fade_duration)
. set_delay(stay_duration)
. finished
. connect(_change_scene)
)
func _change_scene(): func _change_scene():
get_tree().change_scene_to_packed(next_scene) get_tree().change_scene_to_packed(next_scene)

View File

@ -3,10 +3,10 @@ extends Node2D
@export_range(1, 16, 1) var max_persons = 16 @export_range(1, 16, 1) var max_persons = 16
var audience: Array[AudienceMember] = [] var audience: Array[AudienceMember] = []
var overall_mood: float = 0 var overall_mood: float = 0
func _ready(): func _ready():
var counter = 0 var counter = 0
var person = preload("res://scenes/crowd/person.tscn") var person = preload("res://scenes/crowd/person.tscn")
@ -20,6 +20,7 @@ func _ready():
if counter == max_persons: if counter == max_persons:
break break
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta): func _process(_delta):
overall_mood = 0 overall_mood = 0

View File

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://scenes/crowd/crowd.gd" id="1_y7wyj"] [ext_resource type="Script" path="res://scenes/crowd/crowd.gd" id="1_y7wyj"]
[ext_resource type="Texture2D" uid="uid://b6p145ne8x013" path="res://sprites/room/table.svg" id="2_bax5s"] [ext_resource type="Texture2D" uid="uid://b6p145ne8x013" path="res://sprites/room/table.svg" id="2_bax5s"]
[ext_resource type="PackedScene" uid="uid://bbehbuw5lvfkr" path="res://sprites/room/chair.tscn" id="3_y4hpm"] [ext_resource type="PackedScene" path="res://sprites/room/chair.tscn" id="3_y4hpm"]
[node name="Crowd" type="Node2D"] [node name="Crowd" type="Node2D"]
position = Vector2(240, 232) position = Vector2(240, 232)
@ -131,3 +131,7 @@ z_index = 46
position = Vector2(237, 15) position = Vector2(237, 15)
[node name="Chair" parent="Seats/Seat_16" instance=ExtResource("3_y4hpm")] [node name="Chair" parent="Seats/Seat_16" instance=ExtResource("3_y4hpm")]
[node name="CanvasModulate" type="CanvasModulate" parent="."]
show_behind_parent = true
color = Color(0.494118, 0.494118, 0.494118, 1)

View File

@ -141,14 +141,16 @@ func set_random_face():
func on_joke_start(): func on_joke_start():
is_listening = true is_listening = true
func on_joke_finish(joke: Joke): func on_hear_joke(joke: Joke):
is_listening = false
var mood_change = profile.joke_mood_mapping.get(joke.type, 0) var mood_change = profile.joke_mood_mapping.get(joke.type, 0)
if joke.type == last_joke_heard: if joke.type == last_joke_heard:
mood_change = min(0, mood_change) mood_change = min(0, mood_change)
update_mood(mood_change) update_mood(mood_change)
last_joke_heard = joke.type last_joke_heard = joke.type
func on_joke_finish():
is_listening = false
func throw_bottle(): func throw_bottle():
mood += 2.0 mood += 2.0

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=18 format=3 uid="uid://cicyfp5xjvvu4"] [gd_scene load_steps=19 format=3 uid="uid://cicyfp5xjvvu4"]
[ext_resource type="Texture2D" uid="uid://bg85if5rrrdmm" path="res://sprites/room/buehne.svg" id="1_32lst"] [ext_resource type="Texture2D" uid="uid://bg85if5rrrdmm" path="res://sprites/room/buehne.svg" id="1_32lst"]
[ext_resource type="Script" path="res://scenes/Tim.gd" id="1_g3k2b"] [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"] [ext_resource type="Texture2D" uid="uid://kq63ictuirhc" path="res://sprites/tim_side.png" id="1_saxit"]
[ext_resource type="Script" path="res://scenes/Boundary.gd" id="2_8p6ir"] [ext_resource type="Script" path="res://scenes/Boundary.gd" id="2_8p6ir"]
[ext_resource type="PackedScene" uid="uid://r1i7ln2hpwq5" path="res://scenes/joke_button.tscn" id="3_0t41i"] [ext_resource type="PackedScene" uid="uid://r1i7ln2hpwq5" path="res://scenes/joke_button.tscn" id="3_0t41i"]
[ext_resource type="Texture2D" uid="uid://bmx2q0w1s046n" path="res://sprites/ui/spotlight.svg" id="3_8lu50"]
[ext_resource type="Texture2D" uid="uid://b8tb4o75kjffn" path="res://sprites/tim_talk.svg" id="3_e1fvx"] [ext_resource type="Texture2D" uid="uid://b8tb4o75kjffn" path="res://sprites/tim_talk.svg" id="3_e1fvx"]
[ext_resource type="Script" path="res://scenes/DisplayStamina.gd" id="6_88orn"] [ext_resource type="Script" path="res://scenes/DisplayStamina.gd" id="6_88orn"]
[ext_resource type="FontFile" uid="uid://le2vdo2626vw" path="res://fonts/Montserrat-Medium.ttf" id="6_pb3a7"] [ext_resource type="FontFile" uid="uid://le2vdo2626vw" path="res://fonts/Montserrat-Medium.ttf" id="6_pb3a7"]
@ -121,9 +122,18 @@ action = "joke_button_3"
[node name="Joke Transmitter" type="Node2D" parent="Tim"] [node name="Joke Transmitter" type="Node2D" parent="Tim"]
[node name="Spotlight" type="PointLight2D" parent="Tim/Joke Transmitter"]
self_modulate = Color(1, 1, 1, 0)
show_behind_parent = true
z_index = -20
position = Vector2(2.08165e-12, -500)
energy = 0.4
texture = ExtResource("3_8lu50")
[node name="Area2D" type="Area2D" parent="Tim/Joke Transmitter"] [node name="Area2D" type="Area2D" parent="Tim/Joke Transmitter"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Tim/Joke Transmitter/Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Tim/Joke Transmitter/Area2D"]
position = Vector2(0, -176)
shape = SubResource("RectangleShape2D_wmfel") shape = SubResource("RectangleShape2D_wmfel")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Tim"] [node name="AnimationPlayer" type="AnimationPlayer" parent="Tim"]

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="250.00002"
height="1000.0001"
viewBox="0 0 66.145836 264.58335"
version="1.1"
id="svg1"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1">
<linearGradient
id="linearGradient1">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0.10467289"
id="stop1" />
<stop
style="stop-color:#ffffff;stop-opacity:0.9372549;"
offset="0.90093458"
id="stop4" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop2" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient1"
id="linearGradient2"
x1="-0.56500155"
y1="132.57417"
x2="66.145836"
y2="132.57417"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0.28250201,-0.28251351)" />
</defs>
<g
id="layer1">
<rect
style="fill:url(#linearGradient2);fill-opacity:1;stroke:none;stroke-width:0.565"
id="rect1"
width="66.145836"
height="264.58334"
x="0"
y="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bmx2q0w1s046n"
path="res://.godot/imported/spotlight.svg-f6d684577e7bd3fc0fb3e8fdd58e1327.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ui/spotlight.svg"
dest_files=["res://.godot/imported/spotlight.svg-f6d684577e7bd3fc0fb3e8fdd58e1327.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false