[英]How to add a Get Ready screen in spritekit
Hi I want to add a title or label that says Get Ready and when you tap it you start spawning custom sprites. 嗨,我想添加标题为“准备好”的标题或标签,当您点击它时,便开始生成自定义精灵。 Does any one know how to do this.
有谁知道如何做到这一点。 As a reference I want the Get ready screen to act like Flappy Birds or Splashy Fish.
作为参考,我希望“准备就绪”屏幕的行为类似于“飞扬的小鸟”或“泼溅的鱼”。 Anywhere I can get info on this?
我可以在任何地方获得有关此信息吗?
You need to creat a SKSpriteNode with the image you want and add to your scene. 您需要使用所需的图像创建一个SKSpriteNode并将其添加到场景中。
SKSpriteNode *getReady = [SKSpriteNode spriteNodeWithImageNamed:@"myImage.png"];
//remember to set position and other custom stuff here
[self addChild:getReady];
Then when the user tap you can run an action to fade it out. 然后,当用户点击时,您可以运行一个动作以使其淡出。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
SKAction *fadeOut = [SKAction fadeOutWithDuration:10];
[getReady runAction:fadeOut];
}
Also, I think you would be great if you check out some tutorials, cause that's really basic stuff. 另外,我认为如果您阅读一些教程,那会很棒,因为这确实是基本的知识。 I'm sure you can easily find then.
我相信您可以轻松找到。
SKSpriteNode *getReady = [SKSpriteNode spriteNodeWithImageNamed:@"myImage.png"];
//remember to set position and other custom stuff here
[self addChild:getReady];
_isFirst = YES; //BOOL property
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_isFirst)
{
SKAction *fadeOut = [SKAction fadeOutWithDuration:10];
[getReady runAction:fadeOut];
_isFirst = NO;
} else {
//other time you tap, code here
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.