에 장면을 전환하는 방법, 내가 목표 - C에서 다음 코드와 같은 성공적으로 사용 뭔가하려고에서 새로운 장면는 스프라이트 키트를 사용하여 신속한
if ([touchedNode.name isEqual: @"Game Button"]) {
SKTransition *reveal = [SKTransition revealWithDirection:SKTransitionDirectionDown duration:1.0];
GameScene *newGameScene = [[GameScene alloc] initWithSize: self.size];
// Optionally, insert code to configure the new scene.
newGameScene.scaleMode = SKSceneScaleModeAspectFill;
[self.scene.view presentScene: newGameScene transition: reveal];
}
을 기르는 것 스위프트 내 간단한 게임 포트, 지금까지 나는이 작업 ...
for touch: AnyObject in touches {
let touchedNode = nodeAtPoint(touch.locationInNode(self))
println("Node touched: " + touchedNode.name);
let touchedNodeName:String = touchedNode.name
switch touchedNodeName {
case "Game Button":
println("Put code here to launch the game scene")
default:
println("No routine established for this")
}
을하지만 실제로 다른 장면으로 전환에 쓸 어떤 코드 모른다. 질문 :
- 누군가 Swift에서 SKTransition을 사용하는 예를 제공해 줄 수 있습니까?
- 대개 다른 장면 코드를 다른 장면에 넣으려고합니까? Objective-C 아래 있다고 가정 할 때, 아니면 다르게 접근해야 함을 의미하는 Swift 사용에 대해 뭔가가 있습니까?
그것은의 당신에게 달려 종류의, 당신은
2 스위프트 실제로는 자동적으로 모듈에있는 모든 파일을 수입하기 때문에 쉽게 여러 개의 파일을 사용할 수있게 . Objective-C –