我有一个旋转的重试按钮,按下后会使用source.cpp
显示一个新场景。发生此转换时,旋转停止。我的目标是保持按钮旋转,直到GameScene完全呈现。如果它有帮助,这都是在基于SpriteKit的游戏中完成的。任何帮助将不胜感激!
谢谢: - )
答案 0 :(得分:3)
将转换对象上的pausesOutgoingScene
属性设置为false。
var transition = SKTransition.fadeWithDuration(2)
transition.pausesOutgoingScene = false
//transition.pausesIncomingScene = false //Uncomment if you want both to animate
GameView.presentScene(GameScene, transition: transition )
答案 1 :(得分:0)
您可以使用UIKit元素
制作全球属性
unlockButton: UIButton!
并在场景中进行设置
unlockButton = UIButton(type: UIButtonType.System) as UIButton
unlockButton.frame = CGRectMake(width * 2, height * 2, width, height)
unlockButton.backgroundColor = SKColor.clearColor()
unlockButton.layer.borderColor = SKColor.blackColor().CGColor
unlockButton.layer.borderWidth = DeviceManager.convertCGFloat(1)
unlockButton.layer.cornerRadius = DeviceManager.convertCGFloat(2)
unlockButton.setTitle("ButtonTitle", forState: .Normal)
unlockButton.titleLabel?.font = UIFont(name: "YourFont", size: 14)
unlockButton.setTitleColor(UIColor.blackColor(), forState: .Normal)
unlockButton.addTarget(self, action: "unlockButtonPressed:", forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(unlockButton)
比使用
之类的东西 CGAffineTransformMakeRotation
和
UIView animateWithDuration
让它旋转。
转换完成后,您应该可以使用
将其删除 unlockButton.removeFromSuperView()
来自新场景。