From accb60788ab8db58df713428832c546a311e2eb3 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 25 Nov 2023 16:15:42 +0100 Subject: [PATCH 1/4] stuff --- Root.tscn | 26 +++++++++++++++----------- obstacles/{house.tscn => house_a.tscn} | 2 +- obstacles/house_b.tscn | 15 +++++++++++++++ obstacles/house_c.tscn | 14 ++++++++++++++ 4 files changed, 45 insertions(+), 12 deletions(-) rename obstacles/{house.tscn => house_a.tscn} (92%) create mode 100644 obstacles/house_b.tscn create mode 100644 obstacles/house_c.tscn diff --git a/Root.tscn b/Root.tscn index cf9c28b..6f4327a 100644 --- a/Root.tscn +++ b/Root.tscn @@ -8,7 +8,7 @@ [ext_resource type="Script" path="res://TextBox.gd" id="4_gpkq6"] [ext_resource type="FontFile" uid="uid://qf3uxmta6lpw" path="res://fonts/FiraCode-Medium.ttf" id="5_yvnu2"] [ext_resource type="Script" path="res://Camera3D.gd" id="8_auifr"] -[ext_resource type="PackedScene" uid="uid://ck1im1d6yhv84" path="res://obstacles/house.tscn" id="8_ntqnl"] +[ext_resource type="PackedScene" uid="uid://dp7p16vtxd1xr" path="res://obstacles/house_c.tscn" id="9_xyam4"] [sub_resource type="Theme" id="Theme_hkcet"] Label/fonts/font = ExtResource("3_p3wyc") @@ -126,6 +126,7 @@ script = ExtResource("3_y362g") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.927202, 0) script = ExtResource("1_wt4gx") input_accel = 8.0 +jump_impulse = Vector3(0, 10, 0) friction = 0.99 [node name="Man" type="CollisionShape3D" parent="Player"] @@ -165,20 +166,23 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0) shape = SubResource("BoxShape3D_2bm1d") [node name="Camera3D" type="Camera3D" parent="." node_paths=PackedStringArray("target")] -transform = Transform3D(1, 0, 0, 0, 0.582109, 0.813111, 0, -0.813111, 0.582109, 0, 14.3066, 11.1673) +transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 21.3066, 18.1673) script = ExtResource("8_auifr") target = NodePath("../Player") -[node name="House" parent="." instance=ExtResource("8_ntqnl")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14, 0, -11) - -[node name="House2" parent="." instance=ExtResource("8_ntqnl")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.36658, 0, 13.6653) - -[node name="House3" parent="." instance=ExtResource("8_ntqnl")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17.9757, 0, -2.54637) - [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] transform = Transform3D(-0.579826, -0.58827, -0.563685, 0.632141, -0.761305, 0.144266, -0.514003, -0.272679, 0.813294, 0, 0, 0) +[node name="HouseC" parent="." instance=ExtResource("9_xyam4")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14.9482, 0, -6.46428) + +[node name="HouseC2" parent="." instance=ExtResource("9_xyam4")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.94815, 0, 15.5357) + +[node name="HouseC3" parent="." instance=ExtResource("9_xyam4")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -21.0518, 0, -18.4643) + +[node name="HouseC4" parent="." instance=ExtResource("9_xyam4")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -18.0518, 0, 8.53572) + [connection signal="timeout" from="UI/TextBox/Timer" to="UI/TextBox" method="_on_timer_timeout"] diff --git a/obstacles/house.tscn b/obstacles/house_a.tscn similarity index 92% rename from obstacles/house.tscn rename to obstacles/house_a.tscn index fa93452..fa390c8 100644 --- a/obstacles/house.tscn +++ b/obstacles/house_a.tscn @@ -4,7 +4,7 @@ [sub_resource type="BoxShape3D" id="BoxShape3D_atvc4"] -[node name="House" type="StaticBody3D"] +[node name="HouseA" type="StaticBody3D"] [node name="house1" parent="." instance=ExtResource("1_6lk2f")] transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0) diff --git a/obstacles/house_b.tscn b/obstacles/house_b.tscn new file mode 100644 index 0000000..9807995 --- /dev/null +++ b/obstacles/house_b.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=3 format=3 uid="uid://dpm1n7fku8ypr"] + +[ext_resource type="PackedScene" uid="uid://b61483mtne85g" path="res://models/house2.glb" id="1_fuiwk"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_atvc4"] + +[node name="HouseB" type="StaticBody3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.14025, 0, -9.44414) + +[node name="house2" parent="." instance=ExtResource("1_fuiwk")] +transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(8, 0, 0, 0, 10, 0, 0, 0, 8, 0, 5, 0) +shape = SubResource("BoxShape3D_atvc4") diff --git a/obstacles/house_c.tscn b/obstacles/house_c.tscn new file mode 100644 index 0000000..7cab673 --- /dev/null +++ b/obstacles/house_c.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://dp7p16vtxd1xr"] + +[ext_resource type="PackedScene" uid="uid://01cg0ph8uglg" path="res://models/house3.glb" id="1_7obe1"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_atvc4"] + +[node name="HouseC" type="StaticBody3D"] + +[node name="house3" parent="." instance=ExtResource("1_7obe1")] +transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 4, 0) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(8, 0, 0, 0, 10, 0, 0, 0, 8, 0, 5, 0) +shape = SubResource("BoxShape3D_atvc4") From 325afdbff69c10d2d9bbefdfa3800b2832e4bfc6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 25 Nov 2023 16:28:03 +0100 Subject: [PATCH 2/4] cisio --- Root.tscn | 34 ++++++++++++++++++++++++++++------ TextBox.gd | 7 ++++--- obstacles/dialog.gd | 11 +++++++++++ obstacles/dialog.tscn | 23 +++++++++++++++++++++++ 4 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 obstacles/dialog.gd create mode 100644 obstacles/dialog.tscn diff --git a/Root.tscn b/Root.tscn index 6f4327a..c659dbf 100644 --- a/Root.tscn +++ b/Root.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=20 format=3 uid="uid://4whij2hmts0t"] +[gd_scene load_steps=21 format=3 uid="uid://4whij2hmts0t"] [ext_resource type="Script" path="res://Player.gd" id="1_wt4gx"] [ext_resource type="Material" uid="uid://dondfiavgo2ws" path="res://Unshaded.material" id="2_upp15"] +[ext_resource type="Texture2D" uid="uid://uogmi4pvp64t" path="res://addons/bisio.png" id="3_27tel"] [ext_resource type="Texture2D" uid="uid://bwiymy4ls5l8a" path="res://addons/kenney_prototype_textures/red/texture_05.png" id="3_gtnhv"] [ext_resource type="FontFile" uid="uid://cseshyj4yw2f5" path="res://fonts/FiraSans-Medium.ttf" id="3_p3wyc"] [ext_resource type="Script" path="res://GameTimer.gd" id="3_y362g"] @@ -9,13 +10,11 @@ [ext_resource type="FontFile" uid="uid://qf3uxmta6lpw" path="res://fonts/FiraCode-Medium.ttf" id="5_yvnu2"] [ext_resource type="Script" path="res://Camera3D.gd" id="8_auifr"] [ext_resource type="PackedScene" uid="uid://dp7p16vtxd1xr" path="res://obstacles/house_c.tscn" id="9_xyam4"] +[ext_resource type="PackedScene" uid="uid://ccs202pcy4pce" path="res://obstacles/dialog.tscn" id="10_6ihn6"] [sub_resource type="Theme" id="Theme_hkcet"] Label/fonts/font = ExtResource("3_p3wyc") -[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_tn1wg"] -size = Vector2(48, 48) - [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_castg"] [sub_resource type="CapsuleMesh" id="CapsuleMesh_pnmjt"] @@ -85,10 +84,18 @@ grow_vertical = 2 [node name="Character" type="TextureRect" parent="UI/TextBox/Panel/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 0 -texture = SubResource("PlaceholderTexture2D_tn1wg") +texture = ExtResource("3_27tel") expand_mode = 2 -[node name="RichTextLabel" type="RichTextLabel" parent="UI/TextBox/Panel/HBoxContainer"] +[node name="MarginContainer" type="MarginContainer" parent="UI/TextBox/Panel/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_constants/margin_left = 16 +theme_override_constants/margin_top = 16 +theme_override_constants/margin_right = 16 +theme_override_constants/margin_bottom = 16 + +[node name="RichTextLabel" type="RichTextLabel" parent="UI/TextBox/Panel/HBoxContainer/MarginContainer"] layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/normal_font_size = 32 @@ -185,4 +192,19 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -21.0518, 0, -18.4643) [node name="HouseC4" parent="." instance=ExtResource("9_xyam4")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -18.0518, 0, 8.53572) +[node name="Dialog" parent="." instance=ExtResource("10_6ihn6")] +transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 1, -7) +text = "uno" +duration = 1.0 + +[node name="Dialog2" parent="." instance=ExtResource("10_6ihn6")] +transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 1, -16) +text = "due" +duration = 1.0 + +[node name="Dialog3" parent="." instance=ExtResource("10_6ihn6")] +transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 1, -25) +text = "tre" +duration = 1.0 + [connection signal="timeout" from="UI/TextBox/Timer" to="UI/TextBox" method="_on_timer_timeout"] diff --git a/TextBox.gd b/TextBox.gd index 3e86d2e..82dedfe 100644 --- a/TextBox.gd +++ b/TextBox.gd @@ -1,11 +1,12 @@ extends MarginContainer +class_name TextBox func display(s: String, t: float): - $Panel/HBoxContainer/RichTextLabel.show() - $Panel/HBoxContainer/RichTextLabel.text = s + show() + $Panel/HBoxContainer/MarginContainer/RichTextLabel.text = s $Timer.start(t) func _on_timer_timeout(): - $Panel/HBoxContainer/RichTextLabel.hide() + hide() diff --git a/obstacles/dialog.gd b/obstacles/dialog.gd new file mode 100644 index 0000000..f25f572 --- /dev/null +++ b/obstacles/dialog.gd @@ -0,0 +1,11 @@ +extends Area3D + + +@export var text: String +@export var duration: float + +@onready var textbox: TextBox = get_tree().root.find_children("TextBox", "TextBox", true, false)[0] + + +func _on_body_entered(body): + textbox.display(text, duration) diff --git a/obstacles/dialog.tscn b/obstacles/dialog.tscn new file mode 100644 index 0000000..ad0b2ae --- /dev/null +++ b/obstacles/dialog.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=5 format=3 uid="uid://ccs202pcy4pce"] + +[ext_resource type="Script" path="res://obstacles/dialog.gd" id="1_gbnol"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_30roe"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4cwf4"] +transparency = 1 +albedo_color = Color(1, 1, 0, 0.0705882) + +[sub_resource type="BoxMesh" id="BoxMesh_gmxbh"] +material = SubResource("StandardMaterial3D_4cwf4") + +[node name="Dialog" type="Area3D"] +script = ExtResource("1_gbnol") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("BoxShape3D_30roe") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +mesh = SubResource("BoxMesh_gmxbh") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] From 38e5445d5531c5573009803c29e73766dd5edf7d Mon Sep 17 00:00:00 2001 From: Leonardo <321501@studenti.unimore.it> Date: Sat, 25 Nov 2023 16:34:49 +0100 Subject: [PATCH 3/4] Add buccia --- Buccia.gd | 17 +++++++++++++++++ Player.gd | 2 ++ Root.tscn | 28 ++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 Buccia.gd diff --git a/Buccia.gd b/Buccia.gd new file mode 100644 index 0000000..067bb45 --- /dev/null +++ b/Buccia.gd @@ -0,0 +1,17 @@ +extends Area3D + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + + +func _on_body_entered(body): + if body is Player: + body.on_banana() + pass # Replace with function body. diff --git a/Player.gd b/Player.gd index e5df21d..9f02768 100644 --- a/Player.gd +++ b/Player.gd @@ -25,6 +25,8 @@ func do_jump(): current_jumps -= 1 velocity += jump_impulse +func on_banana(): + velocity *= 2 func _physics_process(delta): diff --git a/Root.tscn b/Root.tscn index cf9c28b..be65205 100644 --- a/Root.tscn +++ b/Root.tscn @@ -1,7 +1,7 @@ -[gd_scene load_steps=20 format=3 uid="uid://4whij2hmts0t"] +[gd_scene load_steps=25 format=3 uid="uid://4whij2hmts0t"] [ext_resource type="Script" path="res://Player.gd" id="1_wt4gx"] -[ext_resource type="Material" uid="uid://dondfiavgo2ws" path="res://Unshaded.material" id="2_upp15"] +[ext_resource type="Material" path="res://Unshaded.material" id="2_upp15"] [ext_resource type="Texture2D" uid="uid://bwiymy4ls5l8a" path="res://addons/kenney_prototype_textures/red/texture_05.png" id="3_gtnhv"] [ext_resource type="FontFile" uid="uid://cseshyj4yw2f5" path="res://fonts/FiraSans-Medium.ttf" id="3_p3wyc"] [ext_resource type="Script" path="res://GameTimer.gd" id="3_y362g"] @@ -9,6 +9,7 @@ [ext_resource type="FontFile" uid="uid://qf3uxmta6lpw" path="res://fonts/FiraCode-Medium.ttf" id="5_yvnu2"] [ext_resource type="Script" path="res://Camera3D.gd" id="8_auifr"] [ext_resource type="PackedScene" uid="uid://ck1im1d6yhv84" path="res://obstacles/house.tscn" id="8_ntqnl"] +[ext_resource type="Script" path="res://Buccia.gd" id="10_ffcw5"] [sub_resource type="Theme" id="Theme_hkcet"] Label/fonts/font = ExtResource("3_p3wyc") @@ -43,6 +44,15 @@ size = Vector2(200, 200) [sub_resource type="BoxShape3D" id="BoxShape3D_2bm1d"] size = Vector3(200, 4, 200) +[sub_resource type="BoxShape3D" id="BoxShape3D_stil7"] +size = Vector3(0.976957, 1, 1) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_icp2k"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hs2tx"] + +[sub_resource type="BoxMesh" id="BoxMesh_n8jcf"] + [node name="Root" type="Node3D"] [node name="UI" type="Control" parent="."] @@ -181,4 +191,18 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17.9757, 0, -2.54637) [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] transform = Transform3D(-0.579826, -0.58827, -0.563685, 0.632141, -0.761305, 0.144266, -0.514003, -0.272679, 0.813294, 0, 0, 0) +[node name="Buccia" type="Area3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.36238, 0.418784, -3.1441) +script = ExtResource("10_ffcw5") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Buccia"] +shape = SubResource("BoxShape3D_stil7") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Buccia/CollisionShape3D"] +material_override = SubResource("StandardMaterial3D_icp2k") +material_overlay = SubResource("StandardMaterial3D_hs2tx") +mesh = SubResource("BoxMesh_n8jcf") +skeleton = NodePath("../..") + [connection signal="timeout" from="UI/TextBox/Timer" to="UI/TextBox" method="_on_timer_timeout"] +[connection signal="body_entered" from="Buccia" to="Buccia" method="_on_body_entered"] From 88bed3ed055f1bd811cff77b0afa6c2662dbc556 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 25 Nov 2023 16:40:28 +0100 Subject: [PATCH 4/4] only display if player --- obstacles/dialog.gd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obstacles/dialog.gd b/obstacles/dialog.gd index f25f572..36a146f 100644 --- a/obstacles/dialog.gd +++ b/obstacles/dialog.gd @@ -8,4 +8,5 @@ extends Area3D func _on_body_entered(body): - textbox.display(text, duration) + if body is Player: + textbox.display(text, duration)