It gives me this error. Is there something wrong with my code?
extends KinematicBody2D
const UP = Vector2(0,-1)
var motion = Vector2()
var is_dead = false
var grav = 18
var timer = null
var is_dashing = false
func _physics_process(delta):
if is_dashing == true:
motion.y += grav
motion.x += 1000
if is_dead == false:
motion.y += grav
motion.x = 300
if Input.is_action_pressed("ui_right"):
dash()
if is_on_floor():
if Input.is_action_just_pressed("ui_select"):
motion.y = -400
if Pixel.has_node("pass_through"):
Pixel.set_collision_mask_bit(1,false)
else:
motion.y = -400
move_and_slide(motion,UP)
if get_slide_count():
for i in range(get_slide_count()):
if "Fire" in get_slide_collision(i).collider.name:
dead()
if get_slide_count():
for i in range(get_slide_count()):
if "Flame" in get_slide_collision(i).collider.name:
dead()
func dead():
is_dead = true
$DeathSound.play()
motion = Vector2(0,0)
$Particles2D.emitting = true
$Sprite.play("dead")
$CollisionShape2D.disabled = true
$deadtimer.start()
func _on_Luck_Bits_body_entered(body):
global.luckscore +=1
print(global.luckscore)
func _on_Spring_body_entered(body):
motion.y = -500
func _on_deadtimer_timeout():
get_tree().reload_current_scene()
func _on_dashtimer_timeout():
motion.x = 300
func dash():
is_dashing = true
motion.x = 5000
$dashtimer.start()