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

This commit is contained in:
Waldemar Tomme 2024-01-27 20:17:17 +01:00
commit 177e59243b
5 changed files with 85 additions and 29 deletions

View File

@ -0,0 +1,15 @@
extends Label
var audience : Array[AudienceMember] = []
# Called when the node enters the scene tree for the first time.
func _ready():
for seat in get_node("/root/IngameScene/Crowd/Seats").get_children():
audience.append(seat.get_node("Person"))
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var mood = 0
for m in audience:
mood += m.mood
text = str(int(mood))

View File

@ -0,0 +1,7 @@
extends Label
@onready var Tim : Comedian = get_node("../../Tim")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
text = str(int(max(0, Tim.stamina)))

View File

@ -1,3 +1,4 @@
class_name Comedian
extends Node2D
@export var move_speed = 100
@ -5,6 +6,8 @@ extends Node2D
@export var tim_sprite : Sprite2D
@export var transmitter_area: Area2D
@export var stamina : int = 100
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

View File

@ -1,10 +1,12 @@
[gd_scene load_steps=8 format=3 uid="uid://cicyfp5xjvvu4"]
[gd_scene load_steps=11 format=3 uid="uid://cicyfp5xjvvu4"]
[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="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="PackedScene" uid="uid://r1i7ln2hpwq5" path="res://scenes/joke_button.tscn" id="3_0t41i"]
[ext_resource type="Script" path="res://scenes/DisplayStamina.gd" id="6_88orn"]
[ext_resource type="Script" path="res://scenes/DisplayMood.gd" id="7_5m0td"]
[sub_resource type="CircleShape2D" id="CircleShape2D_jfw8v"]
radius = 23.0217
@ -12,6 +14,9 @@ radius = 23.0217
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wmfel"]
size = Vector2(250, 10000)
[sub_resource type="LabelSettings" id="LabelSettings_aq472"]
font_size = 32
[node name="Stage" type="Node2D"]
z_index = 100
@ -67,6 +72,32 @@ shape = SubResource("RectangleShape2D_wmfel")
[node name="Boundary" type="Node2D" parent="."]
script = ExtResource("2_8p6ir")
[node name="DisplayGUI" type="CanvasLayer" parent="."]
follow_viewport_enabled = true
[node name="Stamina" type="Label" parent="DisplayGUI"]
offset_right = 80.0
offset_bottom = 46.0
text = "100"
label_settings = SubResource("LabelSettings_aq472")
horizontal_alignment = 1
vertical_alignment = 1
script = ExtResource("6_88orn")
[node name="Mood" type="Label" parent="DisplayGUI"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -170.0
offset_right = -10.0
offset_bottom = 46.0
grow_horizontal = 0
text = "0"
label_settings = SubResource("LabelSettings_aq472")
horizontal_alignment = 2
vertical_alignment = 1
script = ExtResource("7_5m0td")
[connection signal="button_pressed" from="Tim/Joke Buttons/Joke Button 1" to="Tim" method="_on_joke_button_button_pressed"]
[connection signal="button_pressed" from="Tim/Joke Buttons/Joke Button 2" to="Tim" method="_on_joke_button_button_pressed"]
[connection signal="button_pressed" from="Tim/Joke Buttons/Joke Button 3" to="Tim" method="_on_joke_button_button_pressed"]

File diff suppressed because one or more lines are too long