measuring distance moved by player

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
001 Supporter
Joined: Fri Oct 23, 2009 2:04 pm

measuring distance moved by player

Postby joihnsonlee » Sun Aug 13, 2017 4:00 am

hi i want a script to measure the distance made by the player when the player has moved

User avatar
001 Support
Joined: Mon Mar 04, 2013 1:19 am
Location: Wisconsin, USA

Re: measuring distance moved by player

Postby AnvilHouse » Sun Aug 13, 2017 2:18 pm

well i would suggest you making it yourself, here is a hint
save the starting X,Y,Z to a variable, get the X,Y,Z of target location, then do the math between said coordinates
Image Image Image ...yes...I am on Patreon!

-The store is under construction-
All items are guaranteed to work with 001 ;)

User avatar
Ultimate 001 Member
Joined: Tue Sep 29, 2009 10:50 pm
Location: Seattle, Washington

Re: measuring distance moved by player

Postby RamchuK_Ntertainment » Sun Aug 13, 2017 4:55 pm

There are lots of alternative ways to calculating distance traveled, but the easiest would be using the built in function: Main.Steps It's an accurate reading of how many pixels the actor has actually walked. For turn-based games or in those where movement is very well-defined and constrained, you can easily apply Anvil's suggestion. In real-time projects, your best bet would be to either use the built-in function or script your own in a 0s delay timer, which would update the tracker variable based on the difference between two sets of coordinates (current position and last position). It's quick math, so it wouldn't be problematic. This is most useful if you plan on tracking distance traveled of multiple actors or just one which is not scripted as "main".
Travesty: 3D Survival - WIP >>> Forum Topic
University of Washington (BABA)
-REGT- Ramchuk Entertainment Games Team

Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users