用python编写pygame代码时发生 'seturn' outside function的错误
def runGame():
#setup veriables for the start of the game
board = getBlankBoard()
lastMoveDownTime = time.time()
lastMoveSidewaysTime = time.time()
lastFallTime = time.time()
movingDown = False #noet: there is no movingUp variable
movingLeft = False
movingRight = False
score = 0
level,fallFreq = calculateLevelAndFallFreq(score)
fallingPiece = getNewPiece()
nextPiece = getNewPiece()
while True:#game loop
if fallingPiece == None:
#No falling piece in play,so start a new piece at the top
fallingPiece = nextPiece
nextPiece = getNewPiece()
lastfallTime = time.time()#reset lastFallTime
if not isValidPosition(board,fallingPiece):
return
checkForQuit()
'return' outside function
return中的r被框红
搜百度
成功运行