summaryrefslogtreecommitdiff
path: root/client/Player.cs
diff options
context:
space:
mode:
authorJoel Stålnacke <joel@saker.fi>2025-07-26 21:09:26 +0300
committerJoel Stålnacke <joel@saker.fi>2025-07-26 21:09:26 +0300
commit63506e59366acddf4a9e017ad8aebeadcf58c164 (patch)
tree2fa106661b85497fc1d63b7743a78e523ab48fba /client/Player.cs
parent53f68bb7b0dce309723675c4b97f726a469031c0 (diff)
Old changesHEADmaster
Diffstat (limited to 'client/Player.cs')
-rw-r--r--client/Player.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/client/Player.cs b/client/Player.cs
new file mode 100644
index 0000000..da95275
--- /dev/null
+++ b/client/Player.cs
@@ -0,0 +1,24 @@
+using Godot;
+using System;
+using Djup.Native;
+
+public partial class Player : Node2D
+{
+ [Export]
+ public World World { get; set; }
+ public uint Id { get; set; } = 0;
+
+ public unsafe override void _Process(double delta)
+ {
+ byte input = 0;
+ if (Input.IsActionPressed("up"))
+ input |= (byte)PlayerInput.Up;
+ if (Input.IsActionPressed("down"))
+ input |= (byte)PlayerInput.Down;
+ if (Input.IsActionPressed("left"))
+ input |= (byte)PlayerInput.Left;
+ if (Input.IsActionPressed("right"))
+ input |= (byte)PlayerInput.Right;
+ World.SetPlayerInput(Id, input);
+ }
+}