Delete the last Dependency:
“[ext_resource path=“res://Scenes/Game.tscn” type=“PackedScene” id=12]”
from the file, as well as:
“[node name=“PopSound” parent=“Player” instance=ExtResource( 12 )]”
and then try to load it again
i deleted it,i am saving it and without anything just reload godot yes?
yes try that
Thank you veryyy much you just saved my game.And now i will try to fix music problem
No problem. If you have questions about your music problem, just ask them
as you said i put music_player on the game.gd srcipt but not worked
extends Node2D
const SPAWN_INTERVAL = 0.4 # Adjust spawn interval as needed
var spawn_timer = 0.0
onready var music_player = $"/root/Menu/MusicPlayer"
func _process(delta):
spawn_timer += delta
if spawn_timer >= SPAWN_INTERVAL:
spawn_bullet()
spawn_timer = 0.0
func spawn_bullet():
var bullet_scene = preload("res://Scenes/Bullet.tscn")
var bullet_instance = bullet_scene.instance()
var viewport_width = get_viewport().size.x
bullet_instance.position.x = rand_range(0, viewport_width)
get_tree().root.add_child(bullet_instance)
func playerDied(pop_effect_instance) -> void:
add_child(pop_effect_instance)
yield(get_tree().create_timer(3), "timeout")
get_tree().change_scene("res://Scenes/Menu.tscn")
music_player.stop()
I need some clarification. How many music_players do you have? Is there a music_player in your Game-Scene? Whats supposed to happen to the music when the player dies?
no there is not music_player in my player script, and i want when my player dies after it the music stops and reload on the menu scene(i just made it with autoplay but it was playing over the old music and it was bad)
Does the Game-Scene have a music_player?
Okay lets try this first:
Put this in your Menu.gd-script:
onready var music_player = get_node("MusicPlayer")
func _ready():
music_player.stop()
music_player.play()
made it
And does it change anything?
Delete this line from Game.gd
onready var music_player = $“/root/Menu/MusicPlayer” this one?
Delete Line 25 of Game.gd:
music_player.stop()
Delete this one as well