sprite-kit

Creating a custom slider using Sprite Kit - how do I pass a @selector?

℡╲_俬逩灬. 提交于 2019-12-07 14:21:16
问题 A Sprite Kit game I'm working on uses a custom slider to act as a color picker (the color is picked from the slider track graphic, which is a UIImage containing a gradient). I looked into using a customised UISlider , but standard IOS UI controls don't play well with Sprite Kit's Scenes: they're difficult to position relative to the rest of the Scene (as they exist as a subview of the main View rather than as a part of a SKScene ), they pop into existence (rather than transitioning with the

having a node follow at a constant speed

主宰稳场 提交于 2019-12-07 13:45:26
问题 I'm trying to make a small mini game where you drag a ball around the screen and every 10 seconds a ball gets added in that follows you. so far the you can drag a ball around the screen and a ball follows you, but when another ball gets added in the balls group together. I think this is because the ball is following me depending on how fast I'm going. so is there a certain way in which I can have the balls follow me at a certain speed constantly, like 10 pixels a second or something, and that

How to loop music with SKAction?

淺唱寂寞╮ 提交于 2019-12-07 13:33:19
问题 I want to loop my background music with an SKAction but the music stops after one row when I switch to an other scene. Is there a way to start the loop and keep playing it over different scenes? Right now the code is placed in the init method of MyScene - is that the correct place? Maybe didFinishLaunchingWithOptions? Here is what I've tried: if (delegate.musicOn == YES && delegate.musicIsPlaying == NO) { SKAction *playMusic = [SKAction playSoundFileNamed:@"loop.wav" waitForCompletion:YES];

Posting score to facebook

谁说我不能喝 提交于 2019-12-07 12:32:10
问题 I created an app in SpriteKit with xcode where when the game is over, it shows you your score, and I want to add the feature to post your score to facebook. Pretty much all my code is in MyScene.m where it can't access presentViewController . Only my ViewController.m file can access that, so I tried calling a instance method in Viewcontroller from Myscene.m but I can't find a way to do that. The only way I have found calling methods from other files is using +(void) which is a class method I

How to create a timer in Spritekit?

邮差的信 提交于 2019-12-07 11:07:00
问题 Ive figured out how to make a timer in a single-view application, but not Spritekit. When I use the following code, I get 2 errors(listed below). Can anyone help me out with this? Thanks, Jack. The timer. if(!_scorelabel) { _scorelabel = [SKLabelNode labelNodeWithFontNamed:@"Courier-Bold"]; _scorelabel.fontSize = 200; _scorelabel.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); _scorelabel.fontColor = [SKColor colorWithHue: 0 saturation: 0 brightness: 1 alpha: .5]

Following a CGPath with SKAction without starting from beginning of CGPath

橙三吉。 提交于 2019-12-07 10:33:09
问题 I have an SKShape node that represents an ellipse. A player is placed on the current point of a Bezier Path that is based on the ellipse's CGPath: I have two actions that the player node can perform. The player can either follow the path clockwise or counterclockwise. rotateCounterClockwiseAction = SKAction.followPath(counterClockwisePath.CGPath, asOffset: false, orientToPath: true, duration: 1) rotateClockwiseAction = SKAction.followPath(clockwisePath.CGPath, asOffset: false, orientToPath:

UIVisualEffectView doesn't blur it's SKView superview

牧云@^-^@ 提交于 2019-12-07 10:28:20
问题 I'm writing a SpriteKit game and faced a problem with blurred view, which lies on the SKView. It is supposed to slide from the right when game is paused and it should blur the content of it's parent view (SKView) just like control center panel in iOS 7. Here is the desired appearance: What I actually get is: In fact the view on the left is not totally black, you can see how highlights from the superview are slightly struggling through almost opaque subview, but no blur is applied. Is it an

Displaying banner ads with SpriteKit

假装没事ソ 提交于 2019-12-07 10:21:52
问题 I'm new to SpriteKit and just published my first game. Now I would like to add banner ads to the game. However, I'm completely lost. Most tutorials tell you to simply call self.canDisplayBannerAds = YES; in the viewDidLoad method. I'm doing that, and I also imported iAD.h and linked the required binaries. However, everytime I start the game it crashes and gives me the following error: -[UIView presentScene:transition:]: unrecognized selector sent to instance 0x15e2dd00 Does anybody know a

Changing SKSpriteNode Frame? Isometric challenges

感情迁移 提交于 2019-12-07 10:12:39
问题 I hope we can figure out how to get around this interesting challenge with a game we are designing in an isometric style. Any help would be so awesome! QUESTION Is there a way to change the bounding box frame from a square to another shape? Maybe using a mask? PROBLEM Our problem is that we need our node's tappable area NOT to be square. Since we are tiling the nodes, their bounding boxes overlap each other, and we cannot accurately tap on the tile that we want. Hopefully our graphic below

Is GameScene.sks not recommended for game building? [closed]

二次信任 提交于 2019-12-07 10:12:18
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . In nearly every tutorial for beginner SpriteKit game making I've seen, people delete the GameScene.sks with no real explination. The reason why building simple non-game apps is so beginner friendly is because of the Storyboard. Ray uses the GameScene here: http://www