From cd7f5ed906cbae15af6a7e2aa38a724fba89127d Mon Sep 17 00:00:00 2001 From: Leonardo <321501@studenti.unimore.it> Date: Sat, 25 Nov 2023 20:37:07 +0100 Subject: [PATCH] Add bullet ball --- Root.tscn | 9 +++++---- Torretta.gd | 2 +- obstacles/bullet_ball.tscn | 26 ++++++++++++++++++++++++++ obstacles/torretta.tscn | 3 --- obstacles/torretta_ball.tscn | 19 ------------------- 5 files changed, 32 insertions(+), 27 deletions(-) create mode 100644 obstacles/bullet_ball.tscn delete mode 100644 obstacles/torretta_ball.tscn diff --git a/Root.tscn b/Root.tscn index bf60af3..6c3d408 100644 --- a/Root.tscn +++ b/Root.tscn @@ -18,7 +18,7 @@ [ext_resource type="PackedScene" path="res://obstacles/vent.tscn" id="15_hwvsi"] [ext_resource type="PackedScene" uid="uid://cbmkrd5kwiujt" path="res://obstacles/torretta.tscn" id="17_6hms3"] [ext_resource type="PackedScene" uid="uid://mahsivqsy3oo" path="res://obstacles/panchina.tscn" id="18_ijdrl"] -[ext_resource type="PackedScene" uid="uid://c1p6udf66lht2" path="res://obstacles/bullet.tscn" id="19_fskgs"] +[ext_resource type="PackedScene" uid="uid://c8ey6yaaj70kw" path="res://obstacles/bullet_ball.tscn" id="19_u5bb2"] [sub_resource type="Theme" id="Theme_hkcet"] Label/fonts/font = ExtResource("3_p3wyc") @@ -260,9 +260,10 @@ transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, -2.89718, 0, 8.66797) [node name="Panchina" parent="." instance=ExtResource("18_ijdrl")] [node name="Torretta" parent="." instance=ExtResource("17_6hms3")] -transform = Transform3D(-0.810819, 0, 0.585297, 0, 1, 0, -0.585297, 0, -0.810819, -5.62694, 0, -13.6183) +transform = Transform3D(-0.810819, 0, 0.585297, 0, 1, 0, -0.585297, 0, -0.810819, -1.29953, 2.64886, 17.8504) -[node name="Bullet" parent="." instance=ExtResource("19_fskgs")] -transform = Transform3D(-4.37114e-08, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, 4.37114e-08, 1.91069e-15, -11.0235, 0, 14.2821) +[node name="Torretta2" parent="." instance=ExtResource("17_6hms3")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 28.2944, 1, -22.5985) +bullet = ExtResource("19_u5bb2") [connection signal="timeout" from="UI/TextBox/Timer" to="UI/TextBox" method="_on_timer_timeout"] diff --git a/Torretta.gd b/Torretta.gd index f5b8468..45760d6 100644 --- a/Torretta.gd +++ b/Torretta.gd @@ -7,7 +7,7 @@ extends StaticBody3D @export var rotation_speed = 0.1 @export var initial_cooldown: float = 0.2 -var bullet = preload("res://obstacles/bullet.tscn") +@export var bullet = preload("res://obstacles/bullet.tscn") var cooldown = 0 # Called when the node enters the scene tree for the first time. diff --git a/obstacles/bullet_ball.tscn b/obstacles/bullet_ball.tscn new file mode 100644 index 0000000..8a5dde7 --- /dev/null +++ b/obstacles/bullet_ball.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=4 format=3 uid="uid://c8ey6yaaj70kw"] + +[ext_resource type="Script" path="res://obstacles/bullet.gd" id="1_igsmj"] +[ext_resource type="PackedScene" uid="uid://c3g6lxikgfr7e" path="res://models/balla.glb" id="2_48nmr"] + +[sub_resource type="SphereShape3D" id="SphereShape3D_c6uuh"] +radius = 0.435146 + +[node name="Bullet" type="RigidBody3D"] +transform = Transform3D(-4.37114e-08, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, 4.37114e-08, 1.91069e-15, 0, 0, 0) +collision_layer = 4 +collision_mask = 4 +gravity_scale = 0.0 +continuous_cd = true +max_contacts_reported = 1 +contact_monitor = true +script = ExtResource("1_igsmj") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, -4.6454e-15, 6.92218e-22, 4.6454e-15, 1, -3.4244e-15, -6.92218e-22, 3.4244e-15, 1, 0, 0, 0) +shape = SubResource("SphereShape3D_c6uuh") + +[node name="balla" parent="." instance=ExtResource("2_48nmr")] +transform = Transform3D(0.427778, 0, -1.05879e-22, 0, 0.427778, 3.57275e-23, -1.05879e-22, 3.57275e-23, 0.427778, 0, 0, 0) + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/obstacles/torretta.tscn b/obstacles/torretta.tscn index 0824947..0787a75 100644 --- a/obstacles/torretta.tscn +++ b/obstacles/torretta.tscn @@ -7,7 +7,6 @@ size = Vector3(1.9188, 3.57475, 2.31203) [node name="Torretta" type="StaticBody3D"] -transform = Transform3D(-0.810819, 0, 0.585297, 0, 1, 0, -0.585297, 0, -0.810819, -11.1919, 0.928251, 6.08668) script = ExtResource("1_wqejx") initial_cooldown = 0.5 @@ -16,5 +15,3 @@ initial_cooldown = 0.5 [node name="CollisionShape3D" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, -2.98023e-08, 0, 1, 0, 2.98023e-08, 0, 1, 0, 1.09828, 0) shape = SubResource("BoxShape3D_hwxik") - -[node name="RayCast3D" type="RayCast3D" parent="."] diff --git a/obstacles/torretta_ball.tscn b/obstacles/torretta_ball.tscn deleted file mode 100644 index 0849ac5..0000000 --- a/obstacles/torretta_ball.tscn +++ /dev/null @@ -1,19 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://ds01yl3tf0tva"] - -[ext_resource type="Script" path="res://Torretta.gd" id="1_6tulh"] -[ext_resource type="PackedScene" uid="uid://t0gblqb4yr8m" path="res://models/turret.glb" id="2_64e5x"] - -[sub_resource type="BoxShape3D" id="BoxShape3D_hwxik"] -size = Vector3(1.9188, 3.57475, 2.31203) - -[node name="Torretta" type="StaticBody3D"] -transform = Transform3D(-0.810819, 0, 0.585297, 0, 1, 0, -0.585297, 0, -0.810819, -11.1919, 0.928251, 6.08668) -script = ExtResource("1_6tulh") - -[node name="turret" parent="." instance=ExtResource("2_64e5x")] - -[node name="CollisionShape3D" type="CollisionShape3D" parent="."] -transform = Transform3D(1, 0, -2.98023e-08, 0, 1, 0, 2.98023e-08, 0, 1, 0, 1.09828, 0) -shape = SubResource("BoxShape3D_hwxik") - -[node name="RayCast3D" type="RayCast3D" parent="."]