![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | LTFTW |
I got this error from a tutorial : E 0:00:00:0902 Condition ’ _debug_parse_err_line >= 0 ’ is true. returned: __null
modules/gdscript/gdscript_editor.cpp:330 @ debug_get_stack_level_instance()
here is the code:
extends Node
class_name Weapon
export var fire_rate = 0.25
export var clip_size = 5
export var reload_rate = 1
onready var ammo_label = $"/root/World/UI/Label"
onready var raycast = $"../Head/Camera/RayCast"
var current_ammo = clip_size
var can_fire = true
var reloading = false
func _process(delta):
ammo_label.set_text("%d / %d" % [currrent_ammo, clip_size])
if Input.is_action_just_pressed("primary_mouse") and can_fire:
if current_ammo > 0 and not reloading:
print("fired weapon")
check_collision()
can_fire = false
current_ammo -= 1
yield(get_tree().create_timer(fire_rate),"timeout")
can_fire = true
elif not reloading:
print("Reloading")
reloading = true
yield(get_tree().create_timer(reload_rate),"timeout")
current_ammo = clip_size
reloading = false
print("Reloaded")
func check_collision():
print("collison check")
if raycast.is_colliding():
print("colliding")
var collider = raycast.get_collider()
if collider.is_in_group("Enemies"):
collider.queue_free()
print("Killed" + collider.name)
the slanted words are wher _ should be
The error is a typo in your code, but it’s impossible to tell what it is because your code formatting is completely messed up from copying it in here as text.
When editing a post here, you can click the “Code Sample” button to format code correctly.
kidscancode | 2020-01-16 00:13
Also, note that if you have a code error, it will be shown in red in the Script Editor of the Godot window.
kidscancode | 2020-01-16 00:14