我知道很多人会因为这个问题而生气但是......
我有一个使用WebGL和Pointer Lock API的游戏.由于很多游戏在CTRL上"蹲伏"的性质,我想知道是否有任何可能的方法来阻止CTRL + S和CTRL + W等浏览器快捷方式......
目前,我不得不严厉禁止控件在其中包含任何CTRL键.我已经将'crouch'设置为C,这也很常见,但我也有关于制作MMORPG风格的游戏的想法,你会有几个能力的动作条,由于CTRL不可行,很多组合是不可能的.
这段代码来自我在学校上课的课程,我对列表的打印方式感到困惑,因为它以"无"结尾...
def printlist(myList, pointer):
print("The List is: ", myList)
print("Pointer length: ", pointer)
print("The List length is: ", len(myList))
print("The List printed properly:")
print(printlistproperly(myList))
def printlistproperly(myList):
thelength = len(myList)
for i in range(thelength):
print(i, " ", myList[i])
def popin(myList,pointer):
myList.append(input("Enter a value: "))
pointer = len(myList)-1
return myList, pointer
def main():
myList = ["Ford","Toyota","Mustang"]
pointer = len(myList)-1
myList,pointer = popin(myList,pointer)
printlist(myList, pointer)
Run Code Online (Sandbox Code Playgroud)
结果是:
>>> main()
Enter a value: Dodge
The List is: ['Ford', 'Toyota', 'Mustang', 'Dodge']
Pointer length: 3
The …Run Code Online (Sandbox Code Playgroud)