Make it possible to dynamically set weapon parans

This commit is contained in:
2025-01-28 10:51:45 +01:00
parent 06a1d28e42
commit b54ffaeb0d
11 changed files with 106 additions and 83 deletions

View File

@ -1,7 +1,7 @@
extends Node3D
const SPEED = 200 # 200
@export var speed: int = 0
@export var damage: int = 0
@onready var mesh = $RigidBody3D/MeshInstance3D
@onready var rigid_body_3d: RigidBody3D = $RigidBody3D
@onready var ray = $RigidBody3D/RayCast3D
@ -15,9 +15,9 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var time_per_frame: float = 1 / Engine.get_frames_per_second()
var distance: float = time_per_frame * SPEED * 1.5
var distance: float = time_per_frame * speed * 1.5
ray.target_position.z = distance
position += transform.basis * Vector3(0, 0, SPEED) * delta
position += transform.basis * Vector3(0, 0, speed) * delta
rigid_body_3d.set_use_continuous_collision_detection(true)
#ray.collision_mask = 1
#ray.enabled = 1
@ -26,7 +26,7 @@ func _process(delta):
if collider != null and collider.is_in_group("target"):
ray.get_collider().take_damage()
if collider != null and collider.is_in_group("body"):
ray.get_collider().hit()
ray.get_collider().hit(damage)
rigid_body_3d.visible = false
particles.emitting = true
#if ray.get_collider().is_in_group("body"):