mirror of
https://github.com/Steffo99/cinnos.git
synced 2024-11-24 17:14:21 +00:00
Fix bullet
This commit is contained in:
parent
7abfebb016
commit
ef99b32bd3
8 changed files with 59 additions and 27 deletions
29
Root.tscn
29
Root.tscn
|
@ -12,13 +12,13 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://ct6sngef76p35" path="res://addons/grass.png" id="9_i8cb1"]
|
[ext_resource type="Texture2D" uid="uid://ct6sngef76p35" path="res://addons/grass.png" id="9_i8cb1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bxj354o6rycsf" path="res://obstacles/house_c.tscn" id="9_xyam4"]
|
[ext_resource type="PackedScene" uid="uid://bxj354o6rycsf" path="res://obstacles/house_c.tscn" id="9_xyam4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ccs202pcy4pce" path="res://obstacles/dialog.tscn" id="10_6ihn6"]
|
[ext_resource type="PackedScene" uid="uid://ccs202pcy4pce" path="res://obstacles/dialog.tscn" id="10_6ihn6"]
|
||||||
[ext_resource type="PlaneMesh" uid="uid://jy4q18wf2j41" uid="uid://jy4q18wf2j41" path="res://road_mesh_something.tres" id="10_7jwjs"]
|
[ext_resource type="PlaneMesh" uid="uid://jy4q18wf2j41" path="res://road_mesh_something.tres" id="10_7jwjs"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bx05lcriqc602" path="res://addons/asphalt_blank.png" id="11_kxmgb"]
|
[ext_resource type="Texture2D" uid="uid://bx05lcriqc602" path="res://addons/asphalt_blank.png" id="11_kxmgb"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d3ikq1a6muafo" path="res://obstacles/goal_billboard.tscn" id="14_0ikhl"]
|
[ext_resource type="PackedScene" uid="uid://d3ikq1a6muafo" path="res://obstacles/goal_billboard.tscn" id="14_0ikhl"]
|
||||||
[ext_resource type="Script" path="res://Torretta.gd" id="15_058li"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://crbal5m8uhcd5" path="res://obstacles/vent.tscn" id="15_hwvsi"]
|
[ext_resource type="PackedScene" uid="uid://crbal5m8uhcd5" path="res://obstacles/vent.tscn" id="15_hwvsi"]
|
||||||
[ext_resource type="PackedScene" uid="uid://t0gblqb4yr8m" path="res://models/turret.glb" id="16_upw73"]
|
[ext_resource type="PackedScene" uid="uid://cbmkrd5kwiujt" path="res://obstacles/torretta.tscn" id="17_6hms3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://mahsivqsy3oo" path="res://panchina.tscn" id="18_ijdrl"]
|
[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"]
|
||||||
|
|
||||||
[sub_resource type="Theme" id="Theme_hkcet"]
|
[sub_resource type="Theme" id="Theme_hkcet"]
|
||||||
Label/fonts/font = ExtResource("3_p3wyc")
|
Label/fonts/font = ExtResource("3_p3wyc")
|
||||||
|
@ -72,9 +72,6 @@ item/3/shapes = []
|
||||||
item/3/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
item/3/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||||
item/3/navigation_layers = 1
|
item/3/navigation_layers = 1
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hwxik"]
|
|
||||||
size = Vector3(1.9188, 3.57475, 2.31203)
|
|
||||||
|
|
||||||
[node name="Root" type="Node3D"]
|
[node name="Root" type="Node3D"]
|
||||||
|
|
||||||
[node name="UI" type="Control" parent="."]
|
[node name="UI" type="Control" parent="."]
|
||||||
|
@ -260,18 +257,12 @@ duration = 1.0
|
||||||
[node name="Vent" parent="." instance=ExtResource("15_hwvsi")]
|
[node name="Vent" parent="." instance=ExtResource("15_hwvsi")]
|
||||||
transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, -2.89718, 0, 8.66797)
|
transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, -2.89718, 0, 8.66797)
|
||||||
|
|
||||||
[node name="Torretta" type="StaticBody3D" parent="."]
|
|
||||||
transform = Transform3D(-0.810819, 0, 0.585297, 0, 1, 0, -0.585297, 0, -0.810819, -11.1919, 0.928251, 6.08668)
|
|
||||||
script = ExtResource("15_058li")
|
|
||||||
|
|
||||||
[node name="turret" parent="Torretta" instance=ExtResource("16_upw73")]
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Torretta"]
|
|
||||||
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="Torretta"]
|
|
||||||
|
|
||||||
[node name="Panchina" parent="." instance=ExtResource("18_ijdrl")]
|
[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)
|
||||||
|
|
||||||
|
[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)
|
||||||
|
|
||||||
[connection signal="timeout" from="UI/TextBox/Timer" to="UI/TextBox" method="_on_timer_timeout"]
|
[connection signal="timeout" from="UI/TextBox/Timer" to="UI/TextBox" method="_on_timer_timeout"]
|
||||||
|
|
|
@ -5,7 +5,7 @@ extends StaticBody3D
|
||||||
|
|
||||||
@export var max_distance: float = 30.0
|
@export var max_distance: float = 30.0
|
||||||
@export var rotation_speed = 0.1
|
@export var rotation_speed = 0.1
|
||||||
@export var initial_cooldown: float = 0.1
|
@export var initial_cooldown: float = 0.2
|
||||||
|
|
||||||
var bullet = preload("res://obstacles/bullet.tscn")
|
var bullet = preload("res://obstacles/bullet.tscn")
|
||||||
var cooldown = 0
|
var cooldown = 0
|
||||||
|
@ -26,7 +26,6 @@ func _physics_process(delta):
|
||||||
cooldown -= delta
|
cooldown -= delta
|
||||||
else:
|
else:
|
||||||
var bull = bullet.instantiate()
|
var bull = bullet.instantiate()
|
||||||
bull.global_position = global_position
|
|
||||||
|
|
||||||
var diff_x = player.global_position.x - global_position.x
|
var diff_x = player.global_position.x - global_position.x
|
||||||
var diff_z = player.global_position.z - global_position.z
|
var diff_z = player.global_position.z - global_position.z
|
||||||
|
@ -34,9 +33,12 @@ func _physics_process(delta):
|
||||||
var diff = Vector3(diff_x, 0, diff_z)
|
var diff = Vector3(diff_x, 0, diff_z)
|
||||||
var norm = diff.normalized()
|
var norm = diff.normalized()
|
||||||
|
|
||||||
|
bull.position = global_position
|
||||||
bull.set_linear_velocity(norm * 50)
|
bull.set_linear_velocity(norm * 50)
|
||||||
|
bull.rotation.y = diff.signed_angle_to(Vector3.FORWARD, Vector3.DOWN)
|
||||||
|
|
||||||
|
get_tree().root.find_child("Root", true, false).add_child(bull)
|
||||||
|
|
||||||
get_tree().root.add_child(bull)
|
|
||||||
cooldown = initial_cooldown
|
cooldown = initial_cooldown
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,4 +14,4 @@ func _process(delta):
|
||||||
func _on_body_entered(body):
|
func _on_body_entered(body):
|
||||||
if body is Player:
|
if body is Player:
|
||||||
body.velocity += (body.global_position - global_position).normalized() * 8
|
body.velocity += (body.global_position - global_position).normalized() * 8
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
|
@ -9,7 +9,7 @@ radius = 0.58729
|
||||||
|
|
||||||
[node name="Bullet" type="RigidBody3D"]
|
[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)
|
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 = 0
|
collision_layer = 4
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
gravity_scale = 0.0
|
gravity_scale = 0.0
|
||||||
continuous_cd = true
|
continuous_cd = true
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://ci3oqjm7d6n5c" path="res://models/veci.glb" id="1_5rsr2"]
|
[ext_resource type="PackedScene" uid="uid://ci3oqjm7d6n5c" path="res://models/veci.glb" id="1_5rsr2"]
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_5q6jj"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_5q6jj"]
|
||||||
size = Vector3(6.47207, 3.91496, 2.44863)
|
size = Vector3(7.427, 3.83, 3.989)
|
||||||
|
|
||||||
[node name="Panchina" type="StaticBody3D"]
|
[node name="Panchina" type="StaticBody3D"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.9953, -1.41734, 0.942567)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.9953, -1.41734, 0.942567)
|
||||||
|
@ -13,5 +13,5 @@ collision_mask = 5
|
||||||
[node name="veci" parent="." instance=ExtResource("1_5rsr2")]
|
[node name="veci" parent="." instance=ExtResource("1_5rsr2")]
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.91611, 2.53125, -0.454214)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.54723, 2.53125, -0.928533)
|
||||||
shape = SubResource("BoxShape3D_5q6jj")
|
shape = SubResource("BoxShape3D_5q6jj")
|
20
obstacles/torretta.tscn
Normal file
20
obstacles/torretta.tscn
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://cbmkrd5kwiujt"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Torretta.gd" id="1_wqejx"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://t0gblqb4yr8m" path="res://models/turret.glb" id="2_m7e8h"]
|
||||||
|
|
||||||
|
[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_wqejx")
|
||||||
|
initial_cooldown = 0.5
|
||||||
|
|
||||||
|
[node name="turret" parent="." instance=ExtResource("2_m7e8h")]
|
||||||
|
|
||||||
|
[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="."]
|
19
obstacles/torretta_ball.tscn
Normal file
19
obstacles/torretta_ball.tscn
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[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="."]
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://d0muettu1wwuw"]
|
[gd_scene load_steps=4 format=3 uid="uid://lnbogqv7l2q4"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Torretta.gd" id="1_vcetf"]
|
[ext_resource type="Script" path="res://Torretta.gd" id="1_vcetf"]
|
||||||
[ext_resource type="PackedScene" uid="uid://t0gblqb4yr8m" path="res://models/turret.glb" id="2_6xcje"]
|
[ext_resource type="PackedScene" uid="uid://t0gblqb4yr8m" path="res://models/turret.glb" id="2_6xcje"]
|
||||||
|
|
Loading…
Reference in a new issue