Files
fps_project_1/scripts/spikes_1.gd
2024-11-07 15:03:19 -06:00

25 lines
716 B
GDScript

extends Node3D
@export_enum("Enemy", "Trap") var enemy_type: int
@export var damage : float = 1
@export var pushback : float = 5
@export var taunts : Array[String] = []
@onready var outline_meshes = [$Spikes1/MeshInstance3D]
@onready var ray_cast: RayCast3D = $RayCast3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_area_3d_body_entered(body: Node3D) -> void:
if body.is_in_group("player"):
body.hit(damage,self,enemy_type)
body.velocity = ray_cast.global_transform.basis * Vector3(0,0,-pushback)