Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS code missing for adding music #8003

Closed
cj-maclean opened this issue Sep 22, 2023 · 1 comment · Fixed by #8017
Closed

CS code missing for adding music #8003

cj-maclean opened this issue Sep 22, 2023 · 1 comment · Fixed by #8017
Labels
area:getting started Issues and PRs related to the Getting Started section of the documentation bug topic:dotnet

Comments

@cj-maclean
Copy link

Your Godot version:
4.1.1
Issue description:
The tutorial is overall very beginner friendly, but on the last bit it uses $Music.play() and while I've been trying to compare the GDScript to C# to try to understand how to translate it into C# I'm not quite proficient enough in both to do that yet. (My goal with this was to get practice using C#).
URL to the documentation page:
https://docs.godotengine.org/en/stable/getting_started/first_2d_game/07.finishing-up.html
If you know how to fix the issue you are reporting please
consider opening a pull request. We provide a tutorial on
using git here: https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html,
writing documentation at https://docs.godotengine.org/en/stable/community/contributing/docs_writing_guidelines.html
and contributing to the class reference here: https://docs.godotengine.org/en/stable/community/contributing/updating_the_class_reference.html

@cj-maclean cj-maclean added the bug label Sep 22, 2023
jynus added a commit to jynus/godot-docs that referenced this issue Sep 23, 2023
The last step in "Your first 2D game" (Finishing up) lacks code or
directions in general for C#. Add a short snipet that can be used
for reference and for copy and paste.

Fixes godotengine#8003
@jynus
Copy link
Contributor

jynus commented Sep 23, 2023

You are completely right, that last part is very rough. I suggested the following addition - let me know if that works for you:
Screenshot_20230923_133419

public void GameOver()
{
    ...
    GetNode<AudioStreamPlayer>("Music").Stop();
    GetNode<AudioStreamPlayer>("DeathSound").Play();
}

public void NewGame()
{
    ...
    GetNode<AudioStreamPlayer>("Music").Play();
}

This is taken almost literally from the tutorial demo at: GDScript C#

jynus added a commit to jynus/godot-docs that referenced this issue Sep 23, 2023
The last step in "Your first 2D game" (Finishing up) lacks code or
directions in general for C#. Add a short snipet that can be used
for reference and for copy and paste.

Fixes godotengine#8003
@raulsntos raulsntos added topic:dotnet area:getting started Issues and PRs related to the Getting Started section of the documentation labels Sep 23, 2023
@raulsntos raulsntos linked a pull request Sep 23, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:getting started Issues and PRs related to the Getting Started section of the documentation bug topic:dotnet
Projects
None yet
3 participants