-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
base: master
Are you sure you want to change the base?
Conversation
Fixed error in C# example
Consistency with the GDScript example
There was a problem hiding this 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
.
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Sure, I’ll fix the other example tomorrow. |
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(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use spaces for indentation.
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) |
There was a problem hiding this comment.
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.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public override void _Process(double _delta) | |
public override void _Process(double delta) |
Co-authored-by: Raul Santos <raulsntos@gmail.com>
No description provided.