【发布时间】:2015-07-21 23:53:18
【问题描述】:
我正在制作一个非常简单的太空游戏;我似乎无法让最后一行工作。理想情况下,我希望在触摸屏幕时让空间向上移动。这是我的代码:
func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
/* Called when a touch begins */
for touch: AnyObject in touches {
touch.locationInNode(self)
spacey.physicsBody!.velocity = (CGVectorMake(0, 0))
spacey.physicsBody!.applyImpulse(0, atPoint: 25)
有人知道怎么做吗?
【问题讨论】:
-
你的观点应该是一个整数吗?
spacey.physicsBody!.applyImpulse(0, atPoint: 25) -
我试过双倍的,它不起作用