|
@@ -38,7 +38,7 @@ Start by declaring the member variables this object will need:
|
|
|
using Godot;
|
|
|
using System;
|
|
|
|
|
|
- public class Player : Area2D
|
|
|
+ public partial class Player : Area2D
|
|
|
{
|
|
|
[Export]
|
|
|
public int Speed = 400; // How fast the player will move (pixels/sec).
|
|
@@ -195,7 +195,7 @@ which returns ``true`` if it's pressed or ``false`` if it isn't.
|
|
|
|
|
|
.. code-tab:: csharp
|
|
|
|
|
|
- public override void _Process(float delta)
|
|
|
+ public override void _Process(double delta)
|
|
|
{
|
|
|
var velocity = Vector2.Zero; // The player's movement vector.
|
|
|
|
|
@@ -290,7 +290,7 @@ the ``_process`` function (make sure it's not indented under the `else`):
|
|
|
|
|
|
.. code-tab:: csharp
|
|
|
|
|
|
- Position += velocity * delta;
|
|
|
+ Position += velocity * (float)delta;
|
|
|
Position = new Vector2(
|
|
|
x: Mathf.Clamp(Position.x, 0, ScreenSize.x),
|
|
|
y: Mathf.Clamp(Position.y, 0, ScreenSize.y)
|