我写了以下内容:
if ((playerVX > 0.0) and (playerVX < maxSpeed)) or ((playerVX < 0.0) and (playerVX > -maxSpeed)):
if not haveJumped and (leftDown or rightDown)
playerVX = playerVX * 1.1
但是,我收到语法错误。有人可以向我解释一下这段代码有什么问题,因为它看起来像是正确缩进给我了吗?
答案 0 :(得分:1)
在(playerVX > 0.0)
比较中看起来像一个额外的括号。
if ((playerVX > 0.0) and (playerVX < maxSpeed)) or ((playerVX < 0.0) and (playerVX > -maxSpeed)):
if not haveJumped and (leftDown or rightDown):
playerVX = playerVX * 1.1
答案 1 :(得分:0)
if(0.0&lt; playerVX&lt; maxSpeed)或(-maxSpeed&lt; playerVX&lt; 0.0): 如果没有jumped和(leftDown或rightDown): playerVX = playerVX * 1.1
这对我有用。