sorry, i should have done that. this is the code that has the problem:
extends Area2D
const HitEffect = preload("res://Effects/HitEffect.tscn")
var invincible = false setget set_invincible
onready var timer = $Timer
signal invincibilitystarted
signal invincibilityended
func setinvincible(value):
invincible = value
if invincible == true:
emitsignal("invincibilitystarted")
else:
emitsignal("invincibility_ended")
func start_invincibility(duration):
self.invincible = true
timer.start(duration)
func createhiteffect():
var effect = HitEffect.instance()
var main = gettree().currentscene
main.addchild(effect)
effect.globalposition = global_position
func onTimer_timeout():
self.invincible = false
func onHurtboxinvincibilitystarted():
set_deferred("monitorable", false)
monitorable = false
func onHurtboxinvincibilityended():
monitorable = true
i added a title screen, which made that the main scene, thus the game tried to put the efect on that scene. i think that is what happened at least.