![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | BIDDIDYBOOPDEV |
This is my problem down bellow
Here’s the code and the error
extends Node
export var fire_rate = 0.5
export var clip_size = 5
export var reload_rate = 1
var current_ammo = clip_size
var can_fire = true
var reloading = false
onready var raycast = $“…/Head/Camera/RayCast”
func _process(_delta):
if Input.is_action_just_pressed(“primary_fire”) and can_fire:
# fire the weapon
if current_ammo > 0 and not reloading:
can_fire = false
print(‘Fired Weapon’)
current_ammo -= 1
yield(get_tree().create_timer(fire_rate), “timeout”)
check_collision()
can_fire = true
elif not reloading:
print('reloading')
reloading = true
yield(get_tree().create_timer(reload_rate), "timeout")
current_ammo = clip_size
print('reload complete')
reloading = false
func check_collision():
if raycast.is_colliding():
var collider = raycast.get_collider()
if collider.is_is_group(“Enemies”):
collider.free_queue()
print('Killed ’ + collider.name)
The error
node not found
This is the node path pasted
Player/Head/Camera/RayCast
So the basic thing that is happening is that it is not finding the node even though everything seems right to me and I have checked so many times that it is spelt right.
SO PLEASE HELP IT WOULD BE VERY APPRECIATED
Please share an image of your scene tree, along with what node you are running this script from.
DDoop | 2020-07-01 17:06