Hello, I would advise against directly using code from PlatinumQuest as is without having sufficient experience, since they are usually coupled with the systems programmed in the game by the developers (they are just usual abstractions and design patterns you'd find everywhere in software engineering side). It's a mature mod that has undergone over a decade of changes during development and as a result, the codebase is significantly different from that of MBG; Things that were handled in MBG are now done differently to take into account the complexity of features and the flexibility of the codebase required to ease future development, as a result one cannot simply just copy code over from PQ and expect it to work as it is. Moreover, there are a few pitfalls that are usually discovered when modding the game. One such pitfall is basically lack of access to the marble velocity which prevents one from directly just using it to implement the speedometer. PlatinumQuest has access to this since it runs on a modified version of the game that exposes that variable to Torquescript. This privilege is not available in Marble Blast Gold so what modifications predating PQ did was to manually calculate the marble velocity based on basic physics/science (the formula: distance travelled divided by time taken results in speed, and ideally it should be taught at some point in school), and then display that value on the user interface. In future, I suggest looking into scripts of other mods apart from PQ whose source is available. (such as MBPU and MBRewind off the top of the head)
I have attached below the modified scripts with the speedometer interface as well as the necessary code for it. The interface won't exactly match with the one in PQ (since thats a bit more troublesome to implement), but it does its job well.
My additions are at the end of the file, with comments explaining the math.
File Attachment:
File Name:
PlayGUI.gui
File Size:14 KB
File Attachment:
File Name:
playgui.cs
File Size:11 KB