我需要让基于时间的记分牌更好地工作
I need to make a time based scoreboard work better
所以我一直在使用乌龟开发 google 恐龙游戏,但我无法让记分牌不断更新,以便每秒增加 100 分。非常感谢任何帮助,因为这是我的期末考试。
谢谢
--谢伊
编辑:
它不让我输入代码,因为它太长了
这是一些东西:
import turtle
delay = 0.1 # For the mainloop
count = 0 # To track when a second past
score = 0 # The score count
pen = turtle.Turtle(visible=False) # The turtle which will write the score
pen.penup()
pen.goto(0,200)
pen.write('Score: {}'.format(score),align='center',font=('Arial',10,'bold'))
while True: # Main game loop
time.sleep(delay) # 1 frame per 0.1 second
count += 1
if count == 10: # When count is 10, that means 10*0.1 seconds have past
score += 100
pen.clear()
pen.write('Score: {}'.format(score),align='center',font=('Arial',10,'bold'))
count = 0 # Set count to zero to start tracking the second again
所以我一直在使用乌龟开发 google 恐龙游戏,但我无法让记分牌不断更新,以便每秒增加 100 分。非常感谢任何帮助,因为这是我的期末考试。 谢谢 --谢伊
编辑: 它不让我输入代码,因为它太长了
这是一些东西:
import turtle
delay = 0.1 # For the mainloop
count = 0 # To track when a second past
score = 0 # The score count
pen = turtle.Turtle(visible=False) # The turtle which will write the score
pen.penup()
pen.goto(0,200)
pen.write('Score: {}'.format(score),align='center',font=('Arial',10,'bold'))
while True: # Main game loop
time.sleep(delay) # 1 frame per 0.1 second
count += 1
if count == 10: # When count is 10, that means 10*0.1 seconds have past
score += 100
pen.clear()
pen.write('Score: {}'.format(score),align='center',font=('Arial',10,'bold'))
count = 0 # Set count to zero to start tracking the second again