Ejemplo n.º 1
0
    public override void _PhysicsProcess(float delta)
    {
        if (this.isBeingPushed)
        {
            pusher.Tick(delta);
            return;
        }

        GetInput();
        LookAt(GetGlobalMousePosition());
        if (!TestMove(this.Transform, velocity * delta))
        {
            this.Position += velocity * delta;
        }

        if (animationPlayer != null)
        {
            if (velocity != Vector2.Zero)
            {
                animationPlayer.Play("walk");
            }
            else
            {
                animationPlayer.Stop();
            }
        }
    }
Ejemplo n.º 2
0
    public override void _PhysicsProcess(float delta)
    {
        if (isBeingPushed)
        {
            pusher.Tick(delta);
            return;
        }

        if (currentPath.Count != 0)
        {
            if (!AmITooCloseToPlayer())
            {
                FollowPath(this.moveSpeed * delta);
            }
        }
    }