1 favourites
• 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
• So, player in my game can pickup things in infinite distance, and i want to restrict the distance

I thought of a simple compare(X or Y): PlayerCoordinate - CursorCoordinate < 100 (100 is the maximum distance of picking up)

But then, i realised that negative numbers excist

Any ideas?

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• you can use ABS() to get the absolute value, or use Distance(x1,y1,x2,y2)

• Could You make a screenshot? i`m a newbie so i don`t understand how some things work

• Just to illustrate AllanR answer.

Both below give the same "50" as a result through "abs()" which means "absolute".

The image below shows how to calculate distance between 2 points.

• Agree,

just to illustrate further, though I think not 100% applicable, in my tutorial on the police chaser I also check for distances to dynamically create road ahead of the car.

If you're new to C3 in general, maybe you'll like the other tuts as well where you can see some possibilities on how to make well known games in general.

Hope this helps you in any way

cheers

• 5 posts