How do i find the distance between 2 points?

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How Do I Find The Distance Between 2 Points?!?

I am trying to develop a “game engine” that can make it easier to develop point-and-click adventure games like The Secret of Monkey Island, Monkey Island 2, and The Day of the Tentacle, etc., but I need the player to be within a certain reach so they can grab items. For example, I put 1 point on the hand (on all the animation frames and animations of the sprite) and 1 in the centre of the item that I want to be picked up. The reason I want this is so that when the “pickup item” animation plays, the hand isn’t too far from the item, so it doesn’t look weird. Right now, I’m only using collision between the item and the player.

If anyone finds out how to make this work with distance between points or a different way to solve the problem of the item-to-pickupanimation distance, I’ll be quite grateful, as this is one of the final and main barriers to completing this “game engine”.

If you have object to another object you can use shortest expression which is

Object.Distance(object)

So for example we wanna check Player to Gold so Player.Distance(Gold)

You can use objects group so you don’t check same object constantly

If you need to specify some position then

Object.DistanceToPosition(X,Y)

Player.DistanceToPosition(Gold.CenterX(),Gold.CenterY())

And longest if you cannot specify any object

DistanceBetweenPositions(X1, Y1, X2, Y2)

DistanceBetweenPositions(Player.CenterX(), Player.CenterY(), Gold.CenterX(), Gold.CenterY())