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

Fixed some errors in C# examples. #8143

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

nbourre
Copy link

@nbourre nbourre commented Oct 3, 2023

No description provided.

Fixed error in C# example
Consistency with the GDScript example
Copy link
Member

@raulsntos raulsntos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to the .NET documentation! Your fixes are looking great.

It looks like the example is using tabs for indentation, but we use spaces in the documentation.

Also, while you are editing this page, could you also fix the example in the Controlling an AnimationPlayer animation section? The _Process method is still using float instead of double.

tutorials/2d/2d_sprite_animation.rst Outdated Show resolved Hide resolved
@raulsntos raulsntos added bug topic:dotnet area:manual Issues and PRs related to the Manual/Tutorials section of the documentation cherrypick:4.0 cherrypick:4.1 labels Oct 3, 2023
Co-authored-by: Raul Santos <raulsntos@gmail.com>
@nbourre
Copy link
Author

nbourre commented Oct 4, 2023

Sure, I’ll fix the other example tomorrow.

Comment on lines +95 to +112
private AnimatedSprite2D _animatedSprite;
public override void _Ready()
{
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
}
public override void _Process(double _delta)
{
if (Input.IsActionPressed("ui_right"))
{
_animatedSprite.Play("run");
}
else
{
_animatedSprite.Stop();
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use spaces for indentation.

Suggested change
private AnimatedSprite2D _animatedSprite;
public override void _Ready()
{
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
}
public override void _Process(double _delta)
{
if (Input.IsActionPressed("ui_right"))
{
_animatedSprite.Play("run");
}
else
{
_animatedSprite.Stop();
}
}
private AnimatedSprite2D _animatedSprite;
public override void _Ready()
{
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
}
public override void _Process(double delta)
{
if (Input.IsActionPressed("ui_right"))
{
_animatedSprite.Play("run");
}
else
{
_animatedSprite.Stop();
}
}

@@ -240,7 +240,7 @@ released.
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
}

public override void _Process(float _delta)
public override void _Process(double _delta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delta parameter name should match the base declaration, even if unused. Sorry that I didn't mention this before, I missed it.

Suggested change
public override void _Process(double _delta)
public override void _Process(double delta)

@@ -70,7 +70,7 @@ Add these two and it's possible to guess almost exactly when sound or music will
GetNode<AudioStreamPlayer>("Player").Play();
}

public override void _Process(float _delta)
public override void _Process(double _delta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public override void _Process(double _delta)
public override void _Process(double delta)

tutorials/audio/sync_with_audio.rst Outdated Show resolved Hide resolved
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation bug cherrypick:4.0 cherrypick:4.1 topic:dotnet
Projects
None yet
2 participants