changes + enemy particles

This commit is contained in:
Michael Campbell 2026-04-30 04:42:00 -04:00
parent 457de8dcaa
commit 0f8f737bc0
12 changed files with 2949 additions and 24 deletions

View file

@ -1,9 +1,10 @@
[gd_scene format=4 uid="uid://b8bqsk60jlnew"]
[ext_resource type="PackedScene" uid="uid://oyqyvj5xo5mf" path="res://enemies/base_enemy.tscn" id="1_ovkbs"]
[ext_resource type="PackedScene" uid="uid://csxewuln32lhk" path="res://enemies/shatters/charging_car_shatter.tscn" id="2_idkrf"]
[ext_resource type="Script" uid="uid://d0ciymxj47qbc" path="res://enemies/charging_car/charger_behavior.gd" id="2_ovkbs"]
[ext_resource type="Texture2D" uid="uid://deucpof3lur15" path="res://models/charger_charger_car_body_albedo.png" id="3_16nkq"]
[ext_resource type="PackedScene" uid="uid://xunielenaajh" path="res://models/charger.glb" id="3_gtwxk"]
[ext_resource type="Texture2D" uid="uid://deucpof3lur15" path="res://models/vehicles/charger_charger_car_body_albedo.png" id="3_16nkq"]
[ext_resource type="PackedScene" uid="uid://xunielenaajh" path="res://models/vehicles/charger.glb" id="3_gtwxk"]
[sub_resource type="BoxShape3D" id="BoxShape3D_8s2ff"]
size = Vector3(5.258606, 2.0716248, 1.2189941)
@ -67,7 +68,9 @@ _surfaces = [{
[sub_resource type="BoxShape3D" id="BoxShape3D_ovkbs"]
size = Vector3(1.7326088, 1.3425293, 1.7998047)
[node name="ChargingCar" unique_id=206023291 instance=ExtResource("1_ovkbs")]
[node name="ChargingCar" unique_id=206023291 node_paths=PackedStringArray("mesh") instance=ExtResource("1_ovkbs")]
shatter_scene = ExtResource("2_idkrf")
mesh = NodePath("Meshes/charger")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hurtbox" parent_id_path=PackedInt32Array(688205599) index="0" unique_id=1037862249]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.0536804, 0.92881775, 0)
@ -84,18 +87,18 @@ unique_name_in_owner = true
[node name="charger" parent="Meshes" index="0" unique_id=1106312542 instance=ExtResource("3_gtwxk")]
transform = Transform3D(-7.365892e-08, 0, -1.6851196, 0, 1.6851196, 0, 1.6851196, 0, -7.365892e-08, 0, 1.2939161, 0)
[node name="CarBody" parent="Meshes/charger" index="0" unique_id=1957256260]
[node name="CarBody" parent="Meshes/charger" index="0" unique_id=1633310356]
material_override = SubResource("StandardMaterial3D_idkrf")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Meshes/charger/CarBody" index="0" unique_id=1073485572]
material_override = SubResource("StandardMaterial3D_16nkq")
mesh = SubResource("ArrayMesh_idkrf")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Meshes/charger/Cylinder_001" parent_id_path=PackedInt32Array(1106312542, 2133559398) index="0" unique_id=1181853677]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Meshes/charger/Cylinder_001" parent_id_path=PackedInt32Array(1106312542, 1528303040) index="0" unique_id=1181853677]
material_override = SubResource("StandardMaterial3D_16nkq")
mesh = SubResource("ArrayMesh_kyms3")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Meshes/charger/Cube_001" parent_id_path=PackedInt32Array(1106312542, 1841021847) index="0" unique_id=1007244050]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Meshes/charger/Cube_001" parent_id_path=PackedInt32Array(1106312542, 566555156) index="0" unique_id=1007244050]
material_override = SubResource("StandardMaterial3D_16nkq")
mesh = SubResource("ArrayMesh_vr87c")

View file

@ -9,6 +9,9 @@ const FRAME_IDXS := 10
@export var knockback_mul := 1.
@export var invulnerable := false
@export var shatter_scene: PackedScene
@export var mesh: Node3D
var frame_idx := 0
var frame_count := 0
@ -56,7 +59,7 @@ func _process(delta: float) -> void:
move_and_slide()
func kill() -> void:
func kill(damager_pos = Vector3.ZERO) -> void:
queue_free()
var siren: AudioStreamPlayer3D = %Siren
@ -72,6 +75,33 @@ func kill() -> void:
t.finished.connect(siren.queue_free)
var meshes: Array[MeshInstance3D]
if shatter_scene:
var shatter: Node3D = shatter_scene.instantiate()
get_tree().current_scene.add_child(shatter)
shatter.global_transform = mesh.global_transform
var rbs := shatter.get_child(1).get_children()
for rb: RigidBody3D in rbs:
var dir = damager_pos.direction_to(rb.global_position)
rb.apply_impulse(dir * 17)
rb.collision_layer = 0
meshes.push_back(rb.get_child(1))
var t2 := shatter.create_tween()
var first := true
t2.tween_interval(1)
for m in meshes:
var t3 = t2
if not first: t3 = t2.parallel()
t3.tween_property(m, "transparency", 1., 0.5)
first = false
t2.finished.connect(shatter.queue_free)
SignalBus.enemy_destroyed.emit()
@ -79,7 +109,7 @@ func hit(proj: Node3D, damage: float) -> bool:
if invulnerable: return true
health -= damage
if health <= 0:
kill()
kill(proj.global_position)
else:
if proj is PlayerProjectile:

File diff suppressed because one or more lines are too long

View file

@ -2,8 +2,9 @@
[ext_resource type="PackedScene" uid="uid://oyqyvj5xo5mf" path="res://enemies/base_enemy.tscn" id="1_s5uvd"]
[ext_resource type="Script" uid="uid://c14x24qxx1wc3" path="res://enemies/police_car/weak_point.gd" id="2_8ru0n"]
[ext_resource type="PackedScene" uid="uid://bk1e0ef0apd8o" path="res://models/police_car.glb" id="2_8t57f"]
[ext_resource type="Texture2D" uid="uid://c6cubsrpkygnd" path="res://models/police_car_car_body_albedo.png" id="3_s7vp5"]
[ext_resource type="PackedScene" uid="uid://bk1e0ef0apd8o" path="res://models/vehicles/police_car.glb" id="2_8t57f"]
[ext_resource type="PackedScene" uid="uid://rqyfmgyawss3" path="res://enemies/shatters/police_car_shatter.tscn" id="2_tdg6c"]
[ext_resource type="Texture2D" uid="uid://c6cubsrpkygnd" path="res://models/vehicles/police_car_car_body_albedo.png" id="3_s7vp5"]
[sub_resource type="BoxShape3D" id="BoxShape3D_8ru0n"]
size = Vector3(2.4451904, 0.5839844, 1.1367188)
@ -55,7 +56,9 @@ size = Vector3(1.6816406, 0.9638672, 0.5)
[sub_resource type="BoxShape3D" id="BoxShape3D_8t57f"]
size = Vector3(0.6993408, 1, 0.88671875)
[node name="PoliceCar" unique_id=206023291 instance=ExtResource("1_s5uvd")]
[node name="PoliceCar" unique_id=206023291 node_paths=PackedStringArray("mesh") instance=ExtResource("1_s5uvd")]
shatter_scene = ExtResource("2_tdg6c")
mesh = NodePath("police_car")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hurtbox" parent_id_path=PackedInt32Array(688205599) index="0" unique_id=1939097710]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0.5496601, 0.34972915, -0.0012522953)
@ -65,7 +68,7 @@ debug_color = Color(0.9913104, 0, 0.27320355, 0.41960785)
[node name="police_car" parent="." index="2" unique_id=1921691252 instance=ExtResource("2_8t57f")]
transform = Transform3D(-7.199207e-08, 0, -1.6469866, 0, 1.6469866, 0, 1.6469866, 0, -7.199207e-08, -0.47187442, 1.1302379, 0)
[node name="CarBody" parent="police_car" index="0" unique_id=1294340001]
[node name="CarBody" parent="police_car" index="0" unique_id=1954562819]
material_override = SubResource("StandardMaterial3D_tdg6c")
[node name="MeshInstance3D" type="MeshInstance3D" parent="police_car/CarBody" index="0" unique_id=1805415760]

View file

@ -26,7 +26,7 @@ func hit(proj: Node3D, _damage: float) -> bool:
label_vfx.position = parent.position
parent.add_sibling(label_vfx)
parent.kill()
parent.kill(proj.global_position)
SignalBus.perfect_shot_hit.emit()

View file

@ -1,9 +1,10 @@
[gd_scene format=4 uid="uid://b7oinpdwh22ux"]
[ext_resource type="PackedScene" uid="uid://oyqyvj5xo5mf" path="res://enemies/base_enemy.tscn" id="1_7uqh4"]
[ext_resource type="PackedScene" uid="uid://bfkfo2o6ftxh3" path="res://models/police_van.glb" id="3_xdbmk"]
[ext_resource type="Texture2D" uid="uid://bwdt7ad6ibdti" path="res://models/police_van_body_albedo.png" id="4_5tnfg"]
[ext_resource type="Texture2D" uid="uid://c85jdrq4127t0" path="res://models/police_van_lights_albedo.png" id="5_2da0u"]
[ext_resource type="PackedScene" uid="uid://bfkfo2o6ftxh3" path="res://models/vehicles/police_van.glb" id="3_xdbmk"]
[ext_resource type="Texture2D" uid="uid://bwdt7ad6ibdti" path="res://models/vehicles/police_van_body_albedo.png" id="4_5tnfg"]
[ext_resource type="Texture2D" uid="uid://c85jdrq4127t0" path="res://models/vehicles/police_van_lights_albedo.png" id="5_2da0u"]
[ext_resource type="PackedScene" uid="uid://2fnt8wgcb88j" path="res://enemies/shatters/police_van_shatter.tscn" id="5_ylgqm"]
[sub_resource type="BoxShape3D" id="BoxShape3D_6pftu"]
size = Vector3(5.7382813, 2.0439758, 1.8857422)
@ -62,10 +63,12 @@ albedo_texture = ExtResource("5_2da0u")
roughness = 0.5
texture_filter = 0
[node name="PoliceVan" unique_id=206023291 instance=ExtResource("1_7uqh4")]
[node name="PoliceVan" unique_id=206023291 node_paths=PackedStringArray("mesh") instance=ExtResource("1_7uqh4")]
max_speed = 10.0
health = 25.0
knockback_mul = 2.0
shatter_scene = ExtResource("5_ylgqm")
mesh = NodePath("police_van")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hurtbox" parent_id_path=PackedInt32Array(688205599) index="0" unique_id=1007044077]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.34838867, 0.57774353, 0)
@ -108,13 +111,13 @@ shape = SubResource("BoxShape3D_7ka6v")
[node name="police_van" parent="." index="4" unique_id=1952355113 instance=ExtResource("3_xdbmk")]
transform = Transform3D(-1.9777934e-08, 0, 0.45246637, 0, 0.45246637, 0, -0.45246637, 0, -1.9777934e-08, 0, 1.0239301, 0)
[node name="Body" parent="police_van" index="0" unique_id=1199253755]
[node name="Body" parent="police_van" index="0" unique_id=626686773]
material_override = SubResource("StandardMaterial3D_t11rc")
[node name="MeshInstance3D" type="MeshInstance3D" parent="police_van/Body" index="0" unique_id=1822399305]
mesh = SubResource("ArrayMesh_03co8")
[node name="Lights" parent="police_van" index="2" unique_id=1814683428]
[node name="Lights" parent="police_van" index="2" unique_id=220033131]
material_override = SubResource("StandardMaterial3D_6njff")
[editable path="police_van"]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long