bullet feels better, added spike traps
This commit is contained in:
21
scripts/spikes_1.gd
Normal file
21
scripts/spikes_1.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Node3D
|
||||
|
||||
@export var damage : float = 1
|
||||
@export var pushback : float = 5
|
||||
@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)
|
||||
body.velocity = ray_cast.global_transform.basis * Vector3(0,0,-pushback)
|
||||
Reference in New Issue
Block a user