Skip to content

XP Orb Pickup Radius Tied to XP Orb #8

@valkyrienyanko

Description

@valkyrienyanko

The players pickup radius should be a upgrade of its own. But currently the pickup radius is directly tied to the xp orb. How can we change this so the players pickup radius factors into this?

Untitled

// XPOrb.cs
public partial class XPOrb : AnimatedSprite2D
{
    public event Action<Player> OnPickup;

    public int Value { get; set; }

    public override void _Ready()
    {
        GetNode<Area2D>("Area2D").BodyEntered += body =>
        {
            if (body is Player player)
            {
                OnPickup?.Invoke(player);

                // Destroy this xp orb
                QueueFree();
            }
        };
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions