저는 SpriteKit으로 시작합니다. 내 스프라이트 노트가 장치의 가장자리에서 튀어 나오길 원합니다. 문제는 가장자리를 추가 할 수있는 방법이 없다는 것입니다.장면 가장자리를 칠 때 노드가 튀어 나와야합니다.
// initWithSize:
_player.physicsBody.dynamic = YES;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
self.physicsWorld.gravity = CGVectorMake(0.0f, 1.0f);
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
self.physicsWorld.gravity = CGVectorMake(0.0f, -1.0f);
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesCancelled:touches withEvent:event];
self.physicsWorld.gravity = CGVectorMake(0.0f, -1.0f);
}
내가 update
방법에 무언가를 추가하려고했습니다, 그러나 위치가 이상한 모양 (I은 가로 모드는, _player.position.y is
~ 150 픽셀 이미 플레이어 @ 표시되지 않습니다. @ 플레이어 그래픽 50x50px이다가 노드는 SKPhysicsBody bodyWithCircleOfRadius:sprite.size.width/2
입니다.
플레이어를 눈에 보이는 위치에서 시작하여 천천히 업데이트하고 좌표계가 어떻게 보이는지 더 잘 이해할 수 있도록 이동하면서 위치를 로그 아웃 할 것을 제안합니다. – Stonz2
이 튜토리얼은 가장자리에서 튀는 공을 가지고 있습니다 : http://www.raywenderlich.com/49721/how-to-create-a-breakout-game-using-spritekit – Jon