Toggling visibility of an animated sprite being visible when player enter collision (Beginner)

Godot Version

4.3

Question

I am trying to make this scene using a Node2D as a base for a background video to be toggled on by the player walking into a collision.

The idea is player walks into collision near a information sprite, that information sprite disappears and the video animated sprite is toggled as visible and playing and the dialogue manager calls the dialogue balloon.

The issue right now is that dialog is being trigger, but all of the visibility is not running. I’m getting a “W 0:00:01:0631 Standalone expression (the line may have no effect).
STANDALONE_EXPRESSION
base_vid.gd:24” How do I make this visibility toggle work, and in the right timing?

extends Node2D
@export var dialogue_resource : DialogueResource
@export var dialogue_start : String = "start"
@onready var xcorps_vid = $XcorpsVid
@onready var signal_i = $SignalI


#func action()-> void:
	#DialogueManager.show_dialogue_balloon(dialogue_resource,dialogue_start)


# Called when the node enters the scene tree for the first time.
func _ready():
	pass


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	pass


func _on_vid_active_area_body_entered(body):
	if body.is_in_group("Player"):
		xcorps_vid.visible == true
		signal_i.visible == false
		xcorps_vid.play()
		DialogueManager.show_dialogue_balloon(dialogue_resource,dialogue_start)
	else:
		xcorps_vid.visible == false
		signal_i.visible == false

xcorps_vid.visible == true

Is valid, but you are comparing if the visibility is true or false by using the double ==. You want to assign the visible property by using a single =.

Your error message is more of a warning that you declared something but never use it in your “base_vid.gd” script at line 24.

You are a god thank you <3 I swear I had tried that but apparently not. worked beautifully.

1 Like