Today’s learning went a little off the rails. This lesson didn’t come from a tutorial. In fact, it came from my brother! I told him how I returned to programming, and in Unity specifically, so he challenged me. I showed him my previous post with the number falling down and his response was, “It would be super cool if they showed the amount of time they had left until they reached the bottom!” My mind immediately rushed through some potential math, which I immediately found was incorrect after trying it in the script. However, after some quick math and writing the number down to get an easier visual of the problem, I got it. Now, I’m sure any mathematician or professional programmer would say this is simple math, but I’m sure newer programmers, and anyone who didn’t get a major in math, would fully disagree. With that said, here is what I came up with!

Alright, to get started I will admit this is the same previously made project as the previous post. That being said, I took my own advice by moving the move code over to the text script, as that allowed my to more easily do the math, and was an unnecessary extra file to begin with. I also changed the speed slightly. The equation I found works the best is (y-1/h)/s/fps or for a cleaner version, (y-1/h)/(s*fps) where y is the textbox’s position, h is the screen height, s is the textbox’s speed, and fps is the game’s set fps.
