Add new methods to input handler, add RectangleShape2d, modify test game.

This commit is contained in:
2023-09-25 17:31:33 +02:00
parent 0b018e081e
commit ddf62f1834
12 changed files with 318 additions and 77 deletions

25
TestGame/TestPlayer.cs Normal file
View File

@@ -0,0 +1,25 @@
using DaggerFramework;
using DaggerFramework.SceneGraph;
using DaggerFramework.Utils;
public class TestPlayer : RectangleShape2d
{
protected override void OnStart()
{
base.OnStart();
Color = Color.Cyan;
}
protected override void OnUpdate(double dt)
{
base.OnUpdate(dt);
var sprinting = Input.IsActionDown("sprint");
_speed = sprinting ? 400f : 200f;
var velocity = Input.GetInputDirection("left", "right", "up", "down") * _speed;
Position += velocity * (float)dt;
}
private float _speed = 200f;
}