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] 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"]