+stamina and mood display

This commit is contained in:
Mikhail Aristov 2024-01-27 19:33:33 +01:00
parent ce5c557a4c
commit fa47248174
5 changed files with 58 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=9 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
@ -80,6 +82,7 @@ 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
@ -93,6 +96,7 @@ 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"]

File diff suppressed because one or more lines are too long