blob: da95275c9d0ec65823d1edb82eb6a65def0af521 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
}
}
|