add projectile destruction and elevation

This commit is contained in:
Teatov 2025-02-27 22:47:08 +10:00
parent a4d6a3eb81
commit 85ee6da79d
6 changed files with 38 additions and 9 deletions

View File

@ -124,10 +124,12 @@ attack={
[layer_names]
3d_render/layer_1="geometry"
3d_render/layer_6="characters"
3d_render/layer_7="projectiles"
3d_render/layer_8="props"
3d_render/layer_9="effects"
3d_physics/layer_1="geometry"
3d_physics/layer_5="player"
3d_physics/layer_6="projectiles"

View File

@ -63,9 +63,9 @@ point_count = 1
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0]
point_count = 1
[sub_resource type="CylinderShape3D" id="CylinderShape3D_apl1i"]
height = 1.8
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_n6vi2"]
radius = 0.3
height = 1.8
[sub_resource type="CylinderShape3D" id="CylinderShape3D_qsqht"]
height = 0.5
@ -269,7 +269,7 @@ mouth_hide_rot_y = 6.283
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0)
shape = SubResource("CylinderShape3D_apl1i")
shape = SubResource("CapsuleShape3D_n6vi2")
[node name="Attack" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://cejn8wfgw14xs"]
[gd_scene load_steps=7 format=3 uid="uid://cejn8wfgw14xs"]
[ext_resource type="Script" path="res://scripts/projectiles/projectile.gd" id="1_kv6x5"]
[ext_resource type="Material" uid="uid://cux40v5s5sok3" path="res://resources/materials/debug/debug_projectile.tres" id="2_b024o"]
@ -7,6 +7,9 @@
[sub_resource type="SphereShape3D" id="SphereShape3D_vc8th"]
radius = 0.25
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xrv5d"]
no_depth_test = true
[sub_resource type="SphereMesh" id="SphereMesh_ctqwx"]
radius = 0.25
height = 0.5
@ -14,7 +17,7 @@ height = 0.5
[node name="Projectile" type="Area3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
collision_layer = 32
collision_mask = 48
collision_mask = 49
script = ExtResource("1_kv6x5")
_collision_debug_material = ExtResource("2_b024o")
@ -23,6 +26,7 @@ shape = SubResource("SphereShape3D_vc8th")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
layers = 64
material_override = SubResource("StandardMaterial3D_xrv5d")
cast_shadow = 0
mesh = SubResource("SphereMesh_ctqwx")

View File

@ -25,6 +25,14 @@ use_collision = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
size = Vector3(50, 1, 50)
[node name="CSGBox3D2" type="CSGBox3D" parent="Geometry/CSGCombiner3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 3.5, -30)
size = Vector3(16.942, 9, 21)
[node name="CSGBox3D3" type="CSGBox3D" parent="Geometry/CSGCombiner3D"]
transform = Transform3D(1, 0, 0, 0, 0.947317, -0.320299, 0, 0.320299, 0.947317, 20.8969, -0.597687, -7.62188)
size = Vector3(16.9418, 8.64539, 28.0487)
[node name="Lights" type="Node" parent="."]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="Lights"]
@ -46,4 +54,7 @@ script = ExtResource("3_f4hhh")
_distance = 30.0
[node name="ProjectileSpawner" parent="." instance=ExtResource("4_84n74")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 9.97514, 0, -7.30423)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 10, 0, -7)
[node name="ProjectileSpawner2" parent="." instance=ExtResource("4_84n74")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 26, 8, -39)

View File

@ -10,6 +10,7 @@ var _spawn_timer: float
func _ready() -> void:
_spawn_timer = _spawn_rate
_spawn_point.position.y = Projectile.HEIGHT
func _process(delta: float) -> void:

View File

@ -18,7 +18,6 @@ func _ready() -> void:
_life_timer = _lifetime
_debug_collision_shapes.init(get_children(), self, _collision_debug_material)
global_position = _start_position
global_position.y = HEIGHT
body_entered.connect(_on_body_entered)
@ -42,7 +41,19 @@ func set_velocity(velocity: Vector3) -> void:
func _on_body_entered(node: Node3D) -> void:
if node is not Player:
if node is Player:
queue_free()
return
queue_free()
print(node)
if node is CollisionObject3D:
var collision_node := node as CollisionObject3D
if collision_node.collision_layer & 1:
queue_free()
return
if node is CSGCombiner3D:
var collision_node := node as CSGCombiner3D
if collision_node.collision_layer & 1:
queue_free()
return