-1
我在與編碼的部分,這是該位Randint沒有指定,即使事先計算 - Python的
def move_bubbles():
for i in range(len(bub_id)):
c.move(bub_id[i], -bub_speed[i], 0)
from time import sleep, time
BUB_CHANCE = 10
#MAIN GAME LOOP
while True:
if randint(1, BUB_CHANCE) == 1:
create_bubble()
move_bubbles()
window.update()
sleep(0.01)
def get_coords(id_num):
pos = c.coords(id_num)
x = (pos[0] + pos[2])/2
y = (pos[1] + pos[3])/2
return x, y
,它說如果randint(1, BUB_CHANCE) == 1:
,顯然randint
沒有定義的麻煩,即使我以前在相同的代碼中使用過它。
有人可以告訴我爲什麼這是一個錯誤?我只使用python幾天:/
你進口嗎? –