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..7234396 100644 --- a/Root.tscn +++ b/Root.tscn @@ -1,7 +1,10 @@ -[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" path="res://Unshaded.material" id="2_upp15"] [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 +12,13 @@ [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"] +[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"] @@ -43,6 +46,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="."] @@ -85,10 +97,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 @@ -126,6 +146,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 +186,53 @@ 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="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("../..") + +[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) + +[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 +>>>>>>> 4e66fbe9af34678e24d9fbad2b46ae8ad17981eb + [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"] 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..36a146f --- /dev/null +++ b/obstacles/dialog.gd @@ -0,0 +1,12 @@ +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): + if body is Player: + 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"] 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")