Hello, I wrote this code ..... which makes clicking on any part of the scene to hide a sprite ...
extends Node2D
func _input(event):
if(event is InputEventMouseButton):
if(event.pressed):
$Sprite.hide()
This code is from another scene ...... and it says that clicking a button instantiates the scene..
extends Node2D
var carta = load("res://Scenas/Carta.tscn")
func open_scene():
var newcarta = carta.instance()
add_child(newcarta)
newcarta.global_position = global_position + Vector2(600,400)
func _on_boton_pressed():
open_scene()
EVERYTHING WORKS WELL ..... THE ONLY BAD THING IS THAT WHEN THE SCENE IS INSTANCED ........ THE IMAGE OF THE INSTANCE SCENE THAT SHOULD BE HIDDEN AFTER CLICKING ... IS HIDDEN IMMEDIATELY .... . AS IF YOU HAD BEEN CLICKED ... BUT I DIDN'T TAKE THAT ACTION...
Maybe they know why that happens ......