After working on one of our new racing games Its time to get back to the sniper game and finish up the game. When a game is almost finished it needs to be tested and when that needs to happen we mostly switch to a new game and work on that for a while. This way we get enough time to test the game and gather all the bugs, think for new features or e.g. simplify the game if it's too hard.
Scrolling score is one of those features that was created during a test session. One of the main aspects of the game is to collect money to improve your team. And to do that you will need to defend your base from waves of enemies. Those enemies will give you money only when they did it wasn't rewarding enough. We heard a sound and we thought we need to enlighten that part a bit more.
So we came up to add a scrolling score. The scrolling score would appear at the enemies position and scroll up and removed after a while in 3D. Only a new problem was created, it needed to be scaled because of the distance between you and the enemy. When you are close or far away it needs to look the same, it can't be too big or too small. And to create a system that would update all the score sign and scale them based on the distance would take more time than just add them in the interface.
But to let them appear in the interface we need a 3d position and project that on the 2d interface. Create a textField on that position and let it scroll. To let this happen we will need to keep track of certain things, the spawn location, timer, scroll offset and which textfield.
The spawn location is needed to calculate the projection to your interface and when you turn your camera or move to a different location we will need a new projection.
With the timer we will know when to disable and remove the textfield.
The Scroll offset, increase each frame and add it to the position.