Added debug labels
This commit is contained in:
2
enemy/Enemy.gd
Normal file
2
enemy/Enemy.gd
Normal file
@ -0,0 +1,2 @@
|
||||
class_name Enemy
|
||||
extends Character
|
18
enemy/EnemyController.gd
Normal file
18
enemy/EnemyController.gd
Normal file
@ -0,0 +1,18 @@
|
||||
class_name EnemyController
|
||||
extends CharacterController
|
||||
|
||||
@export var character: Character
|
||||
var move: Vector2
|
||||
|
||||
func _input(_event):
|
||||
move = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
|
||||
character.direction = (Global.camera.transform.basis * Vector3(move.x, 0, move.y)).normalized()
|
||||
|
||||
if Input.is_action_pressed("jump"):
|
||||
character.jump()
|
||||
|
||||
if Input.is_action_pressed("attack"):
|
||||
print("Attack")
|
||||
|
||||
if Input.is_action_pressed("aim"):
|
||||
print("Aim")
|
@ -1,6 +1,21 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cb2t7bvvf3gwh"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://cb2t7bvvf3gwh"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b358op5h1y83m" path="res://enemy/Slime.blend" id="1_1h1hj"]
|
||||
[ext_resource type="Script" path="res://enemy/Enemy.gd" id="1_r5888"]
|
||||
[ext_resource type="PackedScene" uid="uid://2bbycjulf00g" path="res://character/HealthComponent.tscn" id="2_fsqxc"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_x1ppt"]
|
||||
size = Vector3(0.7, 0.6, 0.7)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qls31"]
|
||||
resource_name = "slime_fall"
|
||||
tracks/0/type = "scale_3d"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Slime")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = PackedFloat32Array(0, 1, 0.5, 1.2, 0.5, 0.5, 1, 0.6, 1, 0.6, 1, 1, 0.5, 1.2, 0.5)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_mdtm7"]
|
||||
resource_name = "slime_idle"
|
||||
@ -16,16 +31,25 @@ tracks/0/keys = PackedFloat32Array(0, 1, 1, 1, 1, 0.5, 1, 0.9, 1.1, 0.9, 1, 1, 1
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1bw8m"]
|
||||
_data = {
|
||||
"slime_fall": SubResource("Animation_qls31"),
|
||||
"slime_idle": SubResource("Animation_mdtm7")
|
||||
}
|
||||
|
||||
[node name="Slime" type="Node3D"]
|
||||
[node name="Slime" type="CharacterBody3D" node_paths=PackedStringArray("model") groups=["enemy"]]
|
||||
script = ExtResource("1_r5888")
|
||||
model = NodePath("Model")
|
||||
|
||||
[node name="Model" parent="." instance=ExtResource("1_1h1hj")]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0452515, 0.3, 0)
|
||||
shape = SubResource("BoxShape3D_x1ppt")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
root_node = NodePath("../Model")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_1bw8m")
|
||||
}
|
||||
autoplay = "slime_idle"
|
||||
|
||||
[node name="HealthComponent" parent="." instance=ExtResource("2_fsqxc")]
|
||||
|
Reference in New Issue
Block a user