Godot Version: v4.2.stable.official [46dc27791]
I am trying to have an escape block with a TextureRect
that has two different textures--an animated one where it's awake and an inanimate one where it's asleep. The textures for my escape blocks display properly on the first room (only if the player just started--no changing scenes beforehand) and appear as a blank white texture other times (i.e. when leaving and reentering the scene). I have tried rewriting my code and using different methods and nodes to swap out the escape block textures, but all of them result in the white texture appearing at least some of the time.
I have tried rewriting my code and using different methods and nodes to swap out the escape block textures, but all of them result in the white texture appearing at least some of the time.
When I changed the wake and sleep functions to something simple (albeit not desired):
func wake():
modulate.a = 1
texture.set_pause(false)
The textures still fail to load. Looks like it has nothing to do with the code failing to swap out the sprites, but rather the textures themselves not loading.
I also tried rewriting the escape block code to use the wake and sleep textures directly rather than applying them to a single texture:
func wake():
wake_rect.visible = true
sleep_rect.visible = false
modulate.a = 1
(Small snippet shown for convenience - full escape block code is on the pastebin I linked)
Still not working.
Can anyone help me figure out what I'm doing wrong or link me to an answer for reference? I’ve looked around but couldn't find anything.
- Here's my code for the escape blocks.
- Here's a screenshots of my scene dock showing Escape Block:
- Here's a short video I uploaded of my running game.