sprite-kit

Shader performance data maybe unavailable due to deployment target older than device version

最后都变了- 提交于 2019-12-31 11:05:13
问题 In a nutshell, I just want to know if I should be concerned about this issue: runtime: GPU Frame Capture : Shader performance data maybe unavailable due to deployment target older than device version The device I am using is running iOS 12.0, and when I had the app set to target iOS 12, this issue was not appearing. However, after I changed the app's target to 11.4, this appeared. Based on my reading of it, and the performance of my app following the change, I do not think this is of any real

Cannot use unarchiveFromFile to set GameScene in SpriteKit

冷暖自知 提交于 2019-12-31 05:45:16
问题 I'm using Xcode 7 beta 2 and following raywenderlich.com's Breakout tutorial to learn SpriteKit. Here's the error I get when I try to load GameScene using unarchiveFromFile. GameScene.type does not have a member named unarchiveFromFile. Here's the code: func didBeginContact(contact: SKPhysicsContact) { // 1. Create local variables for two physics bodies var firstBody: SKPhysicsBody var secondBody: SKPhysicsBody // 2. Assign the two physics bodies so that the one with the lower category is

Passing Data Between Scenes (SpriteKit)

北城以北 提交于 2019-12-31 05:24:18
问题 How do I pass information in SpriteKit from one scene to another? In my game I have two scenes, the GameScene and the GameOverScene. The score is displayed in the GameScene as it increases, but how do I send this information to the second scene? This function is called when the player runs out of lives which changes the scene. func changeScene(){ let secondScene = GameOverScene(size: self.size) secondScene.scaleMode = scaleMode let transition = SKTransition.fadeWithDuration(0.5) self.view?

Swift 2.0, SpriteKit - Scrollview to not use pages.

谁说我不能喝 提交于 2019-12-31 05:16:08
问题 Ok so I have a scrollView which has been subclassed to be able to be applied to any scene which is from a previous question I asked here: SpriteKit, Swift 2.0 - ScrollView in reverse import Foundation import SpriteKit /// Nodes touched var nodesTouched: [AnyObject] = [] // global /// Scroll direction enum ScrollDirection: Int { case None = 0 case Vertical case Horizontal } class CustomScrollView: UIScrollView { // MARK: - Static Properties /// Touches allowed static var disabledTouches =

Swift 2.0, SpriteKit - Scrollview to not use pages.

随声附和 提交于 2019-12-31 05:16:05
问题 Ok so I have a scrollView which has been subclassed to be able to be applied to any scene which is from a previous question I asked here: SpriteKit, Swift 2.0 - ScrollView in reverse import Foundation import SpriteKit /// Nodes touched var nodesTouched: [AnyObject] = [] // global /// Scroll direction enum ScrollDirection: Int { case None = 0 case Vertical case Horizontal } class CustomScrollView: UIScrollView { // MARK: - Static Properties /// Touches allowed static var disabledTouches =

iPhone 5s SpriteKit drawing oddities

别说谁变了你拦得住时间么 提交于 2019-12-31 04:45:26
问题 I understand that the iPhone 5s has a pixel resolution of 640 x 1136 and a point resolution of 320 x 568 (for backward compatibility with non-Retina devices). The problem/confusion/oddity seems to come in when I'm working with SpriteKit. Example: I'm drawing a line from bottom-left corner (0, 0) to top-right corner (width, height). The result was that the line was drawn almost halfway. And indeed when i print out the screen size, it should 320 x 568. So i decided to draw from (0, 0) to (width

stop impulse on SKSpriteKit click

…衆ロ難τιáo~ 提交于 2019-12-31 04:02:19
问题 i'm trying to create an pause button in my game. at the moment when you click on the screen it will apply an impulse on the mover spriteNode. The problem is that it still applying the impulse when i click the pause button. How can i create an pause button without creating the impulse also. i've tried changing the if statements to an else if and then making the last impulse part the else part, but this wont work. touchBegan method: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *

What are good ways to work around the encoding limitation of SKAction code blocks during application state preservation?

廉价感情. 提交于 2019-12-31 03:54:09
问题 Problem When the node hierarchy is encoded, as is common during application state preservation or a “game save”, nodes running SKAction actions with code blocks must be handled specially, since the code blocks cannot be encoded. Example 1: Delayed Callback after Animation Here, an orc has been killed. It is animated to fade out and then remove itself from the node hierarchy: SKAction *fadeAction = [SKAction fadeOutWithDuration:3.0]; SKAction *removeAction = [SKAction removeFromParent];

How to detect contact on different areas of a physicsbody

亡梦爱人 提交于 2019-12-31 03:22:01
问题 I would like to achieve the classic 'headshot' effect in a sprite-kit game. My ideas and attempts: Create separate 'body' and 'head' physicsBodies on the same sprite and pin them with a joint. Impossible :( Create a 'body' physics body on the "enemy" sprite and create another transparent sprite with a 'head' physicsBody that follows the body (sits on top). This approach requires me to keep track of what head is associated with what body. It will also decrease the games efficiency. I am

How to detect contact on different areas of a physicsbody

时间秒杀一切 提交于 2019-12-31 03:21:04
问题 I would like to achieve the classic 'headshot' effect in a sprite-kit game. My ideas and attempts: Create separate 'body' and 'head' physicsBodies on the same sprite and pin them with a joint. Impossible :( Create a 'body' physics body on the "enemy" sprite and create another transparent sprite with a 'head' physicsBody that follows the body (sits on top). This approach requires me to keep track of what head is associated with what body. It will also decrease the games efficiency. I am