18 lines
596 B
C#
18 lines
596 B
C#
using Godot;
|
|
|
|
namespace Tutorial1.Scripts;
|
|
|
|
public partial class Abdullah : Sprite2D {
|
|
private const int AMOUNT = 5;
|
|
private Sprite2D child;
|
|
|
|
public override void _Ready() => child = GetNode<Sprite2D>("Child");
|
|
|
|
public override void _Process(double delta) {
|
|
uint randomNumber = GD.Randi() % 4;
|
|
if (randomNumber == 0) Position += new Vector2(0, -AMOUNT);
|
|
if (randomNumber == 1) Position += new Vector2(0, AMOUNT);
|
|
if (randomNumber == 2) Position += new Vector2(-AMOUNT, 0);
|
|
if (randomNumber == 3) Position += new Vector2(AMOUNT, 0);
|
|
}
|
|
} |