measuring distance moved by player

Have any questions 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.

If you are getting an bug or error, please report it to the Bug and Error Reporting forum section instead.

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.
joihnsonlee
Member
 
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
AnvilHouse
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

https://www.patreon.com/Anvilhouse ...yes...I am on Patreon!


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

User avatar
RamchuK_Ntertainment
Distinguished 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
Strategy/Action/Adventure
Copyrighted©2008-2017


Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users