+random bodies
This commit is contained in:
parent
4d2762773e
commit
4df12455ab
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://c12qb0t5fukxy"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bt8qft2vpyl24" path="res://sprites/bodies/body_blue_1.svg" id="1_ppgo0"]
|
||||||
|
|
||||||
|
[node name="BodyBlue1" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_ppgo0")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://b6r7nlhj70qxd"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dqxv2u4xiwiup" path="res://sprites/bodies/body_blue_2.svg" id="1_qalxe"]
|
||||||
|
|
||||||
|
[node name="BodyBlue2" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_qalxe")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dnpviu6dbg4dr"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://7bw8nqowkthc" path="res://sprites/bodies/body_blue_3.svg" id="1_3emr7"]
|
||||||
|
|
||||||
|
[node name="BodyBlue3" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_3emr7")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bwxnhtolf1j26"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://baijihfhkfk0i" path="res://sprites/bodies/body_green_1.svg" id="1_cnx4p"]
|
||||||
|
|
||||||
|
[node name="BodyGreen1" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_cnx4p")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://6504thpoeyiq"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://p557r4sksm4a" path="res://sprites/bodies/body_green_2.svg" id="1_31bmk"]
|
||||||
|
|
||||||
|
[node name="BodyGreen2" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_31bmk")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://budkcly8pgpvt"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bsy1pfhg1ante" path="res://sprites/bodies/body_green_3.svg" id="1_qcqxr"]
|
||||||
|
|
||||||
|
[node name="BodyGreen3" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_qcqxr")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://5flf4apu2s33"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b6211hcc6kclc" path="res://sprites/bodies/body_red_1.svg" id="1_0fjdh"]
|
||||||
|
|
||||||
|
[node name="BodyRed1" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_0fjdh")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dl3dhmyn6ba8r"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c2cg5x7x14nd" path="res://sprites/bodies/body_red_2.svg" id="1_g6wgn"]
|
||||||
|
|
||||||
|
[node name="BodyRed2" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_g6wgn")
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cthh6v0gf4vqt"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bahxyel8pbh40" path="res://sprites/bodies/body_red_3.svg" id="1_fq8cf"]
|
||||||
|
|
||||||
|
[node name="BodyRed3" type="Sprite2D"]
|
||||||
|
texture = ExtResource("1_fq8cf")
|
|
@ -2,9 +2,12 @@ class_name AudienceMember
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
@export var mood : float = 0.
|
@export var mood : float = 0.
|
||||||
|
@export_enum("blue", "green", "red") var color
|
||||||
|
|
||||||
@export var head : Node2D
|
@export var head : Node2D
|
||||||
@export var face : Node2D
|
@export var face : Node2D
|
||||||
|
@export var body : Node2D
|
||||||
|
@export var body_shape : Node2D
|
||||||
@export var profile : AudienceProfile
|
@export var profile : AudienceProfile
|
||||||
|
|
||||||
@export_enum("angry", "neutral", "happy", "laugh") var expression
|
@export_enum("angry", "neutral", "happy", "laugh") var expression
|
||||||
|
@ -17,6 +20,27 @@ var known_faces : Array[String] = [
|
||||||
# Add more scenes as needed
|
# Add more scenes as needed
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var known_bodies = {
|
||||||
|
"blue" : [
|
||||||
|
"res://scenes/bodies/body_blue_1.tscn",
|
||||||
|
"res://scenes/bodies/body_blue_2.tscn",
|
||||||
|
"res://scenes/bodies/body_blue_3.tscn",
|
||||||
|
# Add more scenes as needed
|
||||||
|
],
|
||||||
|
"green" : [
|
||||||
|
"res://scenes/bodies/body_green_1.tscn",
|
||||||
|
"res://scenes/bodies/body_green_2.tscn",
|
||||||
|
"res://scenes/bodies/body_green_3.tscn",
|
||||||
|
# Add more scenes as needed
|
||||||
|
],
|
||||||
|
"red" : [
|
||||||
|
"res://scenes/bodies/body_red_1.tscn",
|
||||||
|
"res://scenes/bodies/body_red_2.tscn",
|
||||||
|
"res://scenes/bodies/body_red_3.tscn",
|
||||||
|
# Add more scenes as needed
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
const laughter_duration : float = 2. # seconds
|
const laughter_duration : float = 2. # seconds
|
||||||
const laughter_bobs : int = 4
|
const laughter_bobs : int = 4
|
||||||
var laughter_left : float = 0.
|
var laughter_left : float = 0.
|
||||||
|
@ -27,6 +51,9 @@ func _ready():
|
||||||
mood = randf_range(profile.lashout_threshold, profile.happy_threshold)
|
mood = randf_range(profile.lashout_threshold, profile.happy_threshold)
|
||||||
update_expression()
|
update_expression()
|
||||||
|
|
||||||
|
if body_shape == null:
|
||||||
|
set_random_body(color)
|
||||||
|
|
||||||
if face == null:
|
if face == null:
|
||||||
set_random_face()
|
set_random_face()
|
||||||
|
|
||||||
|
@ -69,6 +96,16 @@ func update_expression():
|
||||||
expression = "angry"
|
expression = "angry"
|
||||||
else:
|
else:
|
||||||
expression = "neutral"
|
expression = "neutral"
|
||||||
|
|
||||||
|
func set_random_body(for_color):
|
||||||
|
if str(for_color) not in known_bodies:
|
||||||
|
var keys = known_bodies.keys()
|
||||||
|
for_color = keys[randi() % keys.size()]
|
||||||
|
print(keys.size())
|
||||||
|
var body_path = known_bodies[for_color][randi() % known_bodies[for_color].size()]
|
||||||
|
var body_res = load(body_path)
|
||||||
|
body_shape = body_res.instantiate()
|
||||||
|
body.add_child(body_shape)
|
||||||
|
|
||||||
func set_random_face():
|
func set_random_face():
|
||||||
var face_res = load(known_faces[randi() % known_faces.size()])
|
var face_res = load(known_faces[randi() % known_faces.size()])
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://cl4fax7fbh2g7"]
|
[gd_scene load_steps=4 format=3 uid="uid://cl4fax7fbh2g7"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/crowd/person.gd" id="1_mx0i8"]
|
[ext_resource type="Script" path="res://scenes/crowd/person.gd" id="1_mx0i8"]
|
||||||
[ext_resource type="Script" path="res://scenes/crowd/audience_profile.gd" id="2_bsodr"]
|
[ext_resource type="Script" path="res://scenes/crowd/audience_profile.gd" id="2_bsodr"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dqxv2u4xiwiup" path="res://sprites/bodies/body_blue_2.svg" id="2_t0w5c"]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5rd5b"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5rd5b"]
|
||||||
|
|
||||||
[node name="Person" type="Node2D" node_paths=PackedStringArray("head", "profile")]
|
[node name="Person" type="Node2D" node_paths=PackedStringArray("head", "body", "profile")]
|
||||||
script = ExtResource("1_mx0i8")
|
script = ExtResource("1_mx0i8")
|
||||||
head = NodePath("Head")
|
head = NodePath("Head")
|
||||||
|
body = NodePath("Body")
|
||||||
profile = NodePath("Profile")
|
profile = NodePath("Profile")
|
||||||
expression = 1
|
expression = 1
|
||||||
|
|
||||||
|
@ -16,9 +16,6 @@ expression = 1
|
||||||
position = Vector2(0, 15)
|
position = Vector2(0, 15)
|
||||||
scale = Vector2(0.3, 0.3)
|
scale = Vector2(0.3, 0.3)
|
||||||
|
|
||||||
[node name="BodyBlue2" type="Sprite2D" parent="Body"]
|
|
||||||
texture = ExtResource("2_t0w5c")
|
|
||||||
|
|
||||||
[node name="Head" type="Node2D" parent="."]
|
[node name="Head" type="Node2D" parent="."]
|
||||||
position = Vector2(0, -16)
|
position = Vector2(0, -16)
|
||||||
scale = Vector2(0.3, 0.3)
|
scale = Vector2(0.3, 0.3)
|
||||||
|
|
Loading…
Reference in New Issue