0 votes

why, when switching from the menu scene to the game scene and then to the win scene or defeat, the buttons on the last two scenes are not pressed and the sound of defeat or victory is looped, and if you go straight from the menu scene to the win or defeat scene, then all buttons are pressed and the sounds are played only once?

project link: https://drive.google.com/file/d/1r8A-8I3bzRzcCF0UKM85UxomPLunJ7Ay/view?usp=sharing

in Engine by (126 points)
edited by

Where is asteroids.gd global script ?

--- Debugging process stopped ---
 modules/gdscript/gdscript.cpp:829 - Condition "err" is true. Returned: err
 Cannot load source code from file 'res://global scripts/asteroids.gd'.
 Failed loading resource: res://global scripts/asteroids.gd. Make sure resources have been imported by opening the project in the editor at least once.
 Can't autoload: res://global scripts/asteroids.gd.
 editor/editor_autoload_settings.cpp:488 - Condition "!info->node" is true. Continuing.

forgot to remove this script from startup.
but it still gives me an error:

E 0: 00: 02.066 emit_signal: Error calling method from signal 'pressed': 'TextureButton :: _ on_Button_pressed': Method not found ..
   <C ++ source code> core / object.cpp: 1260 @ emit_signal ()
signal 'pressed': 'TextureButton :: _ on_Button_pressed': Method not found ..

In the error you pasted, there is a space between _ and on. Verify the place where you setup the signal, there should be no space here.

it turned out that this is to blame: colider.queue_free()
as a function of the player's death. I didn't understand how it affects another scene, but when I did this:
if global.lives > 1: colider.queue_free()

everything worked

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.