How to calculate speed

Timothius

Villager
Member
Joined
May 30, 2023
Messages
14
Reaction score
4
First Language
English
Primarily Uses
N/A
In a project, I plan to have MPH and/or KPH displayed on the screen to show how fast the player is going.

But how would I have that calculated to display on the screen?
How would the game know that your current speed is 20mph or 50 mph?

I'm not a big math guy, but I am sure if someone pointed out a simple formula for that, I could code it from there.
Any help appreciated. :)
 

TheoAllen

Self-proclaimed jack of all trades
Regular
Joined
Mar 16, 2012
Messages
7,495
Reaction score
11,668
First Language
Indonesian
Primarily Uses
N/A
Velocity = Displacement / Time

The term itself refers to "Miles Per Hour" or "Kilometer Per Hour".
So it is divided by time. How long does it take to move from A to B.
 

Timothius

Villager
Member
Joined
May 30, 2023
Messages
14
Reaction score
4
First Language
English
Primarily Uses
N/A
Velocity = Displacement / Time

The term itself refers to "Miles Per Hour" or "Kilometer Per Hour".
So it is divided by time. How long does it take to move from A to B.

Wow, super simple! Thanks for the reply!

So all I would really need would be a variable for time, a variable for where I was, where I am currently (displacement), figure out how much time has passed from one coordinate to the next, and then finally a variable for the end result (velocity). I'll have to try this out.
 

Latest Threads

Latest Profile Posts

The site is being slow and funky again. IS SOMEONE CRAFTING POEMS?!
So yeah, @TRIDIUM @TESTOSTERONE, I wuz like, "What do they mean by borderline and boundaries?"

And then, y'all know this girl?

actress1.png

alice_bikini.png

The clothes? They're just a, um, quick edit. :kaoswt:
I've uploaded the opening cutscene from my game to my channel. It basically introduces us to the first three characters, and what their relationships are:
Cosmic Inferno: Opening dialogue
I don't want to start a panic...but everyone, check the color of your milk!
IMG_20231002_082329.jpg
My One Map Challenge is nearing completion. I am in the multiple run testing phase atm. This is the map. Beware the minotaurs in the maze area. The female ones are more aggressive. Can you prove to the land of Winchell that a dragon and a human can love each other?

Forum statistics

Threads
135,021
Messages
1,253,017
Members
177,949
Latest member
fefemaker
Top