From 8ca53a8939d9ee5ef7f6414671e770e671fcc2d4 Mon Sep 17 00:00:00 2001 From: Marvin Dalheimer Date: Fri, 26 Jan 2024 20:54:22 +0100 Subject: [PATCH] add crowd sitting on tables It is configurable how many people are spawned --- godot/scenes/crowd/crowd.gd | 14 +++++ godot/scenes/crowd/crowd.tscn | 76 ++++++++++++++++++++++++++++ godot/scenes/crowd/person.tscn | 7 +++ godot/scenes/crowd/table.png | Bin 0 -> 792 bytes godot/scenes/crowd/table.png.import | 34 +++++++++++++ 5 files changed, 131 insertions(+) create mode 100644 godot/scenes/crowd/crowd.gd create mode 100644 godot/scenes/crowd/crowd.tscn create mode 100644 godot/scenes/crowd/person.tscn create mode 100644 godot/scenes/crowd/table.png create mode 100644 godot/scenes/crowd/table.png.import diff --git a/godot/scenes/crowd/crowd.gd b/godot/scenes/crowd/crowd.gd new file mode 100644 index 0000000..b3b1fe3 --- /dev/null +++ b/godot/scenes/crowd/crowd.gd @@ -0,0 +1,14 @@ +extends Node2D + +@export_range(1, 16, 1) +var max_persons = 16 + +func _ready(): + var counter = 0 + var person = preload("res://scenes/crowd/person.tscn") + for seat in $Seats.get_children(): + seat.add_child(person.instantiate()) + + counter += 1 + if counter == max_persons: + break diff --git a/godot/scenes/crowd/crowd.tscn b/godot/scenes/crowd/crowd.tscn new file mode 100644 index 0000000..c8b7808 --- /dev/null +++ b/godot/scenes/crowd/crowd.tscn @@ -0,0 +1,76 @@ +[gd_scene load_steps=3 format=3 uid="uid://bx6htkgx23t8v"] + +[ext_resource type="Script" path="res://scenes/crowd/crowd.gd" id="1_y7wyj"] +[ext_resource type="Texture2D" uid="uid://c37ydueny6n1f" path="res://scenes/crowd/table.png" id="2_kf115"] + +[node name="Crowd" type="Node2D"] +position = Vector2(240, 232) +script = ExtResource("1_y7wyj") + +[node name="Seats" type="Node" parent="."] + +[node name="Seat_1" type="Node2D" parent="Seats"] +position = Vector2(168, 156) + +[node name="Seat_10" type="Node2D" parent="Seats"] +position = Vector2(311, 137) + +[node name="Seat_7" type="Node2D" parent="Seats"] +position = Vector2(249, 81) + +[node name="Seat_16" type="Node2D" parent="Seats"] +position = Vector2(320, 274) + +[node name="Seat_5" type="Node2D" parent="Seats"] +position = Vector2(205, 35) + +[node name="Seat_12" type="Node2D" parent="Seats"] +position = Vector2(359, 184) + +[node name="Seat_8" type="Node2D" parent="Seats"] +position = Vector2(204, 130) + +[node name="Seat_13" type="Node2D" parent="Seats"] +position = Vector2(315, 187) + +[node name="Seat_2" type="Node2D" parent="Seats"] +position = Vector2(122, 197) + +[node name="Seat_3" type="Node2D" parent="Seats"] +position = Vector2(217, 199) + +[node name="Seat_15" type="Node2D" parent="Seats"] +position = Vector2(366, 231) + +[node name="Seat_4" type="Node2D" parent="Seats"] +position = Vector2(166, 244) + +[node name="Seat_9" type="Node2D" parent="Seats"] +position = Vector2(359, 94) + +[node name="Seat_14" type="Node2D" parent="Seats"] +position = Vector2(276, 232) + +[node name="Seat_6" type="Node2D" parent="Seats"] +position = Vector2(159, 79) + +[node name="Seat_11" type="Node2D" parent="Seats"] +position = Vector2(401, 133) + +[node name="Tables" type="Node" parent="."] + +[node name="Table_1" type="Sprite2D" parent="Tables"] +position = Vector2(170, 199) +texture = ExtResource("2_kf115") + +[node name="Table_2" type="Sprite2D" parent="Tables"] +position = Vector2(359, 138) +texture = ExtResource("2_kf115") + +[node name="Table_3" type="Sprite2D" parent="Tables"] +position = Vector2(203, 84) +texture = ExtResource("2_kf115") + +[node name="Table_4" type="Sprite2D" parent="Tables"] +position = Vector2(319, 230) +texture = ExtResource("2_kf115") diff --git a/godot/scenes/crowd/person.tscn b/godot/scenes/crowd/person.tscn new file mode 100644 index 0000000..91cc48e --- /dev/null +++ b/godot/scenes/crowd/person.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://cl4fax7fbh2g7"] + +[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_kbo53"] +size = Vector2(20, 30) + +[node name="Person" type="Sprite2D"] +texture = SubResource("PlaceholderTexture2D_kbo53") diff --git a/godot/scenes/crowd/table.png b/godot/scenes/crowd/table.png new file mode 100644 index 0000000000000000000000000000000000000000..a6abf2bd49c9872f3ec96c60b099889341348f58 GIT binary patch literal 792 zcmV+z1LypSP)EX>4Tx04R}tkv&MmP!xqvTcsiuL5oOn$WWcyMMWHI6^c+H)C#RSn7s54nlvOS zE{=k0!NH%!s)LKOt`4q(Aov5~?BJy6A|>9J6k5c1;qgAsyXWxUeSp7NWvbbe094H~ zGO47H%dZN-SNIUY5MmgSn5oZ+Vj7jVfq16NwdUuy!hpQJZB zTJ#7Q+y*YLJDR))Ty{D4^000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2j~GB5;Q7HG~hb`000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0002*Nkl}(q$#5s!ilh^+Io&Dzh`N|et0$lX~lnpu?uB^~maAk*%hRX>%0xdUe zFItY+9<*Gst!O!8ThMaH)}nO