I am making a racing game and I want to know something: How do I make gauges for my game. I have 6 gears on car set by states, but only way to visualiate them is game debug. But game debug is ugly- I want to make fancy gauges. How do I make them?

  • $\begingroup$ Hi, please only ask one question at a time. If you want to ask multiple questions then please ask them separately as separate posts. $\endgroup$ – Ray Mairlot Dec 19 '14 at 13:27
  • $\begingroup$ But if they are about one and the sme thing, just 2 actions- can't I ask them both in one place? This is easier for me to check for answers... $\endgroup$ – Adrians Netlis Dec 19 '14 at 13:46
  • 3
    $\begingroup$ I don't think they are the same. One is about visualising data and one is about getting a car to accelerate. $\endgroup$ – Ray Mairlot Dec 19 '14 at 14:28

Assuming the gauges are in an overlay scene, you'll need to establish communication with message sensors.

  1. Send a "gearUp" or "gearDown" message to the gauge when the gear changes
  2. Put message sensors on the gauge that execute whatever action you desire

Here's a quick sample - use the up and down arrow keys to send messages. https://dl.dropboxusercontent.com/u/19279604/static/misc/gauge_example.blend

If the gauges are in the same scene, then it's a whole lot easier. You can shift+click multiple objects and connect gauge actuators directly to the gear controller.


There really isn't a good way to copy properties between scenes with logic bricks. Here's a Python example that can be adapted to your needs:

import bge

def copyProps(cont):
    # Get a reference to the object running the script
    own = cont.owner

    # Get a reference to the overlay scene
    overlay = bge.logic.getSceneList()[1]

    # Find the object in the overlay scene
    other = overlay.objects['Speedometer']

    # Copy the desired properties
    other['Text'] = own['speed']

if __name__ == '__main__':
    cont = bge.logic.getCurrentController()
  • $\begingroup$ I will check it out, but looks useful. Can you also show, how to make it show property value?(I have "speed" property) $\endgroup$ – Adrians Netlis Dec 20 '14 at 17:04
  • $\begingroup$ Unfortunately we can't directly copy properties between scenes with logic bricks. You're pretty much stuck with sending incremental messages. I suppose you could send a message for each unit of speed, but that's a bit silly. I've edited the answer to include a Python script that directly copies properties. $\endgroup$ – pqftgs Dec 20 '14 at 18:36
  • $\begingroup$ What object is Speedometer? Which one shouldI call Speedometer? $\endgroup$ – Adrians Netlis Dec 20 '14 at 19:49
  • $\begingroup$ Should I make evrything else like in your example? Where should I put the scrip controller? $\endgroup$ – Adrians Netlis Dec 20 '14 at 19:50
  • $\begingroup$ Actually, there is an alternate- I can put gauges in the same scene, maybe- I will try... $\endgroup$ – Adrians Netlis Dec 20 '14 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.