backgroundscript is not objectbased anymore

This commit is contained in:
2022-11-27 22:03:20 +01:00
parent 67fa20c946
commit e2f883e736
5 changed files with 10 additions and 7 deletions

View File

@@ -0,0 +1,26 @@
using Godot;
using System;
public partial class player : CharacterBody2D
{
[Export]
public int speed = 400;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _PhysicsProcess(double delta)
{
MoveAndCollide(new Vector2
(
Input.GetActionStrength("move_right")
- Input.GetActionStrength("move_left"),
Input.GetActionStrength("move_down")
- Input.GetActionStrength("move_up")
).LimitLength(1)
* speed * (float)delta
);
}
}