From 84a6611ba33ae655a339d43a6e48b76a4b46954b Mon Sep 17 00:00:00 2001 From: Rob Kelly Date: Wed, 24 Jul 2024 14:02:01 -0600 Subject: [PATCH] Added dummy enemy --- src/npc/dummy/dummy.gd | 12 ++++++++++++ src/npc/dummy/dummy.tscn | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/npc/dummy/dummy.gd create mode 100644 src/npc/dummy/dummy.tscn diff --git a/src/npc/dummy/dummy.gd b/src/npc/dummy/dummy.gd new file mode 100644 index 0000000..0598bb2 --- /dev/null +++ b/src/npc/dummy/dummy.gd @@ -0,0 +1,12 @@ +extends CharacterBody3D + +# Get the gravity from the project settings to be synced with RigidBody nodes. +var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity") + + +func _physics_process(delta: float) -> void: + # Add the gravity. + if not is_on_floor(): + velocity.y -= gravity * delta + + move_and_slide() diff --git a/src/npc/dummy/dummy.tscn b/src/npc/dummy/dummy.tscn new file mode 100644 index 0000000..592cd8a --- /dev/null +++ b/src/npc/dummy/dummy.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=8 format=3 uid="uid://2vetjvn3w0si"] + +[ext_resource type="Script" path="res://src/npc/dummy/dummy.gd" id="1_fw1h8"] +[ext_resource type="Texture2D" uid="uid://b0yefajw1cqo" path="res://assets/textures/character_placeholder.png" id="1_jiqkj"] +[ext_resource type="Shader" path="res://src/shaders/spatial_threshold.gdshader" id="2_lqgq8"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_g4reu"] +render_priority = 0 +shader = ExtResource("2_lqgq8") +shader_parameter/color_low = Color(0, 0, 0, 1) +shader_parameter/color_hi = Color(1, 1, 1, 1) +shader_parameter/threshold = 0.19 +shader_parameter/contrast = 1.0 +shader_parameter/offset = 0.0 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1rns5"] +next_pass = SubResource("ShaderMaterial_g4reu") +albedo_texture = ExtResource("1_jiqkj") + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_b3qv8"] +material = SubResource("StandardMaterial3D_1rns5") +radius = 0.7 + +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_3x80o"] +radius = 0.7 + +[node name="Dummy" type="CharacterBody3D"] +script = ExtResource("1_fw1h8") + +[node name="Mesh" type="Node3D" parent="."] + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Mesh"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +mesh = SubResource("CapsuleMesh_b3qv8") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +shape = SubResource("CapsuleShape3D_3x80o")