-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
area:manualIssues and PRs related to the Manual/Tutorials section of the documentationIssues and PRs related to the Manual/Tutorials section of the documentationbugtopic:dotnet
Description
Your Godot version: 4.1.stable
Issue description: Incorrect C# code sample:
URL to the documentation page: https://docs.godotengine.org/en/stable/tutorials/scripting/instancing_with_signals.html#shooting-example
We use the OnPlayerShoot() function in the last function reference. This throws two errors:
bulletInstance.Rotation = direction: direction is a Vector2, Rotation expects a float.bulletInstance.Velocity: In the previous code sample we setup bullet, but made Velocity a private member, making it inaccessible- Setting Velocity to public in the bullet class gives the same issue as the first issue:
bulletInstance.Velocity.Rotated(direction)=> the Rotated method expects a float.
Potential solution (I'm not sure if this is correct)
- Make Velocity a public field in the bullet class
- change the Rotation line to
bulletInstance.Rotation = direction.Angle(); - change the Velocity.Rotated line to
bulletInstance.Velocity = bulletInstance.Velocity.Rotated(direction.Angle());
Metadata
Metadata
Assignees
Labels
area:manualIssues and PRs related to the Manual/Tutorials section of the documentationIssues and PRs related to the Manual/Tutorials section of the documentationbugtopic:dotnet