sprite-kit

Is it possible to have a Twitter / Facebook share button in a sprite-kit game?

假装没事ソ 提交于 2019-12-21 05:57:03
问题 I'm completely lost, all the tutorials I've found have been for iOS 6 apps with Storyboards. My question is if you can have a twitter or facebook sharing feature in a sprite-kit game? If so what is the best way to go about adding it? Alot of the tutorials I've read over use viewcontrollers but sprite-kit uses scenes so I'm a bit confused. Thanks. 回答1: Here is an answer for twitter. Your Welcome! 1) import the Social framework under the Build Phases tab then Link Binary with Libraries. Put

How to get from SKScene to UIViewController?

自古美人都是妖i 提交于 2019-12-21 05:39:14
问题 I am new to programming and I am trying to build a simple game using Swift and SpriteKit. It looks good now but I have a little problem to solve. How do I get from a SKScene (Game) to a UIViewController in the Storyboard? My game looks like this. In the Storyboard i have 3 views (Main menu, About and Game Over) and 1 SKScene (Game). When the player clicks on the play button in the main menu he gets to the game SKScene. When the player fails I want to get to a new UIViewController where I can

How does JSTileMap handle retina and ipad/iphone tile maps?

爷,独闯天下 提交于 2019-12-21 05:22:40
问题 I have created a basic tilemap using Tiled. I am using JSTileMap with SpriteKit to get the map in the scene. As I understood, JSTileMap (rather SKTexture) handles the retina and different devices automatically. I have not been able to produce good results so far, here is my setup: I have one .tmx file created at a base resolution using map.png as it's tile set. The .tmx is present in the project but I purposely did not add map.png (I do not want to support non-retina iPhones). In the project

Sprite Kit bodyAtPoint and bodyInRect return incorrect values?

时光总嘲笑我的痴心妄想 提交于 2019-12-21 04:57:04
问题 I created a very simple sample code, just one scene, one sprite node 20x20px, at point 0.0 on screen. When I call scene.physicsWorld bodyAtPoint it returns me this node even at point eg: 34x34. But at point 35x35 it returns null . So basically all points from 0px to 34px in both axis returns this node, starting from 35px, it doesn't return it anymore. Any idea what could be the reason, if sprite visibly ends at 20px 20px? The same behaviour is seen in bodyInRect . Here is the sample code: -

Blend UIColors in Swift

你说的曾经没有我的故事 提交于 2019-12-21 04:27:27
问题 I have two SKSpriteNode and their colors are defined like this: colorNode[0].color = UIColor(red: 255, green: 0, blue: 0, alpha: 1) colorNode[1].color = UIColor(red: 0, green: 255, blue: 0, alpha: 1) and I want to have a third SKSpriteNode colorized with a blend of the two first ones, the result should be like this : colorNode[2].color = UIColor(red: 255, green: 255, blue: 0, alpha: 1) but is there a way to addition two UIColors ? Like this : colorNode[2].color = colorNode[0].color +

SpriteKit Liquid (water)

纵然是瞬间 提交于 2019-12-21 03:51:09
问题 How can I get a small amount of liquid in my spriteKit application? I want that liquid in a container, it will be sealed inside but I want it to be able to move around. Is there a better way to implement this? Maybe an option without SpriteKit? EDIT: I was able to simulate water using this tutorial: http://www.raywenderlich.com/85515/liquidfun-tutorial-1 and this sample project I found: https://github.com/safx/liquidfun-ios-sample BUT it requires me to run 2 physics worlds (1 for box2D and 1

Doing completely custom animations with Core Animation - performance

放肆的年华 提交于 2019-12-21 02:52:32
问题 The article https://www.objc.io/issues/12-animations/animating-custom-layer-properties/ has this to say about doing completely custom animations with Core Animation: Suppose that instead of implementing our clock face using individual layers, we wanted to draw the clock using Core Graphics. (In general this will have inferior performance , but it’s possible to imagine that there are complex drawing operations that we might want to implement that would be hard to replicate using ordinary layer

How to load a scene async so you can have a loading screen?

妖精的绣舞 提交于 2019-12-21 02:35:16
问题 My scene loads can take a while, and I want to be able to show a loading animation, however, everything locks up. Is there a way to load the next scene async and get a callback when its ready? 回答1: You can schedule a block for concurrent execution using dispatch_async. Load scene in async block then perform callback method on the main thread like this: __weak MyClass *weakself = self; dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){ //Background thread /

How to create a Gradient in Spritekit?

吃可爱长大的小学妹 提交于 2019-12-20 21:28:21
问题 Is there any possible way to create a gradient filled box in SpriteKit? I've tried filling a shape node with that but it notes that only solid colors work with skshapenode. 回答1: I don't think this is possible with current SKShapeNode , which barely handles its basic features currently. A good approach if you don't want to use pre-existing sprite gradient images would be to create an SKTexture from applying a CIFilter (like maybe CILinearGradient in this case) to a basic box image, and then

Universal 2D Game Assets and Absolute Node Positioning

杀马特。学长 韩版系。学妹 提交于 2019-12-20 18:35:36
问题 I have a question regarding universal game assets and absolute positioning of a SKNodes in Sprite Kit (iOS 8+). I will try to present my problem through an example as follows : Imagine a 2D top down game with a SKSpriteNode which represents a house. A house has multiple child SKSpriteNode s which represent chairs, desk, sofa, etc. I have 3 versions of house asset: 1x - 200 x 200px (Non-retina iPads), 2x - 400 x 400px (Retina iPhones and iPads), 3x - 600 x 600px (iPhone 6 Plus). Important :