and a sidenote, look in the console for any errors
ok i will try thanks
hi bro thanks it working now big thanks for help
watch bro my game much better with speedometer it not perfect speed sometime goes - minus but somethink https://youtu.be/AOCrWfLHxD0
this should fix the negative speed
import bge
import time
import copy
scenes = bge.logic.getSceneList()
dict = bge.logic.globalDict
player = None
def speed(pos):
if "pos" in dict:
speed = 0
if "time" in dict:
t = (dict["pos"] - pos ).length
speed = t / (time.time() - dict["time"])
dict["time"] = time.time()
return int(speed)
return 0
for scene in scenes:
if "Scene" in scene.name:
player = scene.objects["player"]
if "overlay" in scene.name:
if player:
pos = copy.copy(player.worldPosition)
speed = speed(pos)
needle = scene.objects["speed"]
needle["speed"] = speed
speed_txt = "{:>03}".format(speed)
scene.objects["Text"]["Text"] = speed_txt
dict["pos"] = pos
1 Like
is this not doing the same thing as
player.worldPosition.copy()
but without the need for the copy module?
it runs the same so i dont realy care.
cheers bro it fixed you script work no negative speed now thank you so much for help