我对以下代码有疑问:
let torpedoNode = SKSpriteNode(imageNamed: "Torpedo")
torpedoNode.position = player.position
torpedoNode.position.y += 5
torpedoNode.physicsBody = SKPhysicsBody(circleOfRadius: torpedoNode.size / 2)
我得到的错误是这一行:
torpedoNode.physicsBody = SKPhysicsBody(circleOfRadius: torpedoNode.size / 2)
错误是:
二进制运算符'/'不能应用于类型'CGSize'和'Int'的操作数
答案 0 :(得分:2)
CGSize
是一个结构,其中包含两个def maximize(backend=None,fullscreen=False):
"""Maximize window independently on backend.
Fullscreen sets fullscreen mode, that is same as maximized, but it doesn't have title bar (press key F to toggle full screen mode)."""
if backend is None:
backend=matplotlib.get_backend()
mng = plt.get_current_fig_manager()
if fullscreen:
mng.full_screen_toggle()
else:
if backend == 'wxAgg':
mng.frame.Maximize(True)
elif backend == 'Qt4Agg' or backend == 'Qt5Agg':
mng.window.showMaximized()
elif backend == 'TkAgg':
mng.window.state('zoomed') #works fine on Windows!
else:
print ("Unrecognized backend: ",backend) #not tested on different backends (only Qt)
plt.show()
plt.pause(0.1) #this is needed to make sure following processing gets applied (e.g. tight_layout)
值-宽度和高度。
因此您不能将其与CGFloat
分开。
您的parameter似乎仍然需要Int
。因此,您应该将高度或宽度除以2并改为通过。
CGFloat