我正在製作一個遊戲,用戶必須拍攝新一波敵人。Python:有條件的'if'語句來設置速度
我試圖通過檢查當前得分來提高敵人產卵的速度。但是我不斷收到錯誤。
這裏是我的代碼:
for x in range(score):
if score is > 5 and < 10:
spawnrate = 6
elif score is > 10 and < 20:
spawnrate = 8
elif score is > 20:
spawnrate = 10
什麼錯誤?你會收到錯誤信息 - 然後添加全文。 – furas
爲什麼你使用'for'循環? – furas
如果'score'等於10或20,應該發生什麼? – SiHa