I have these events that I have been instancing my entire project that, when open, pause certain player functions to avoid glitches (holding movement and pausing, respectively). I have not had to edit this code for the entire project. It has been working just fine.
But - for some silly reason I can't understand - in only THIS scene when I place this event - and another - in the editor, the bools are not flipping. They work in every other scene, there is no alteration to the code. I even have a custom event in this EXACT same scene that uses the same GLOBALS and.... it works.
There are no objects in scene or code that should be conflicting. Is there some technical feature I am missing? Still in Godot 3.5 currently. I will post the code but I think something is amiss because this code works EVERYWHERE else i use it. please help. about to pull out hair over this one.
extends Area2D
### toggle event and image view, all these are working
var _can_display = false
var _is_viewing = false
export var _viewNoise = false
export var _isHidden = false
func _ready(): ### hide prompt at ready
$LookSprite.visible = false
func _process(_delta):
_toggle_display() ## listen for input and bool
$LookSprite.visible = _can_display ## if can use, prompt on
if _isHidden: ## hide prompts if hidden
$LookSprite.visible = false
$RunSprite.visible = false
func _toggle_display(): ## toggling image on with flag/input
if _can_display == true:
if Input.is_action_just_pressed("_interact"):
if _viewNoise:
$ViewSounds.play()
else:
pass
if _is_viewing == true:
_close_view()
else:
_image_view()
func _image_view(): ## toggle view mode, pause player
_is_viewing = true
DirectorNode._pauseEnabled = false ## disable pause menu! --- works in all other scenes
DirectorNode._freezePlayer = true ## disable player movement ---- works in all other scenes
$DisplayImage.visible = true
func _close_view(): ## toggle off, player free to move
_is_viewing = false
DirectorNode._pauseEnabled = true
DirectorNode._freezePlayer = false
$DisplayImage.visible = false
func _on_ViewEvent_body_entered(body): ## toggle prompt on player enter
if body.name == 'Lydia':
if DirectorNode._chaseMode == false:
_can_display = true
else: ## show RUN if pursued
_can_display = false
$RunSprite.visible = true
$LookSprite.visible = false
func _on_ViewEvent_body_exited(body): ## hide prompt, bool flip on exit
if body.name == 'Lydia':
_can_display = false
$LookSprite.visible = false
$RunSprite.visible = false