skspritenode

IOS 13 Sprite Kit Issues

六眼飞鱼酱① 提交于 2019-12-01 12:08:26
问题 I recently made a game using sprite kit xcode 10.2 which was working fine unless ios 13 update, I tested the game in xcode 11 simulators with ios 13 the fps of the game starts to get reduce to 30-35fps. Also sometimes physics body on sprite nodes is not working properly. sometimes collision is detected on sprite nodes and sometimes it is being detected in middle of the sprite node which was not the case in ios 12 everything was working fine until ios 13 update. 来源: https://stackoverflow.com

Swift: returning to Main Menu after condition is met in GameScene using StoryBoards and UIViewControllers?

那年仲夏 提交于 2019-12-01 08:06:09
问题 Context This question is related to Swift: SKSpriteKit, using Storyboards, UIViewController and UIButton to set in game parameters? and uses the same M.W.E. (link below). Taking a look at the Main.storyboard we see the following: While this storyboard would allow one to progress from left to right by clicking: play -> (easy/hard) -> GameScene UIViewController -> MyUIViewController -> GameViewController and from right to left by clicking the UIButton on the last UIViewController with the

SKSpriteNode pools in iOS 8 seem to be allocated to overlapping memory

安稳与你 提交于 2019-12-01 07:34:57
I might be missing something. But my current app on the appstore works in iOS 7, but in iOS 8 completely fails because it won't create a preallocated pool of sprites. They appear to be written to the same address unless the sprites have specifically different properties. In iOS 7 the following code produces a set with 4 unique objects. In iOS 8, the same code produces a set with only 1 object: NSMutableSet *aSet = [NSMutableSet set]; SKColor *sameColor = [SKColor redColor]; CGSize sameSize = CGSizeMake(10, 10); for (int i = 0; i < 4; i++) { //allocate a brand new sprite SKSpriteNode

SKSpriteNode pools in iOS 8 seem to be allocated to overlapping memory

蓝咒 提交于 2019-12-01 04:16:49
问题 I might be missing something. But my current app on the appstore works in iOS 7, but in iOS 8 completely fails because it won't create a preallocated pool of sprites. They appear to be written to the same address unless the sprites have specifically different properties. In iOS 7 the following code produces a set with 4 unique objects. In iOS 8, the same code produces a set with only 1 object: NSMutableSet *aSet = [NSMutableSet set]; SKColor *sameColor = [SKColor redColor]; CGSize sameSize =

How to bring a SKSpriteNode to front?

我们两清 提交于 2019-12-01 02:05:53
How can I bring a SKSpriteNode to the front of all other node? With UIView, I can use bringSubviewToFront to bring an uiview in front of other views. Fogmeister You can't "bring it to front" but you can change the zPosition of it. The higher the zPosition of the node the later it gets rendered. So if you have three nodes with zPositions of -1, 0 and 1 then the -1 will appear at the back. Then the 0. Then 1 will appear at the front. If they all use the default zPosition of 0.0 then they are rendered in the order they appear in the children array of the parent node. You can read it all in the

Can't tap SKSpriteNode - no touch detected ios

不羁岁月 提交于 2019-12-01 01:54:48
问题 I am pretty new to iOS, objective C and working with Xcode. I only did one simple news type app, but now I would like to create a game I had published on another platform. Basically, I have one object that will appear randomly and then fade out and the purpose is to tap on the object to make it go away. However I can't seem to tap the object, even though I set mySKSpriteNode.userInteractionEnabled = YES; Here is what I have in my touchesBegan method: -(void)touchesBegan:(NSSet *)touches

Does Sprite Kit load a texture atlas multiple times if I use SKTextureAtlas later?

眉间皱痕 提交于 2019-11-30 19:11:38
问题 This is making me think. Game starts and I create sprites with -spriteNodeWithImageNamed: method. Later for animation, I create a SKTextureAtlas object. Some people say it is faster because -spriteNodeWithImageNamed: will first look in your app bundle for a png and after this it will look into the atlas. But what is unclear to me: If I create a SKTextureAtlas later will this know about the already loaded atlas image or will it be dumb and just load the image again? And if I create

How to cut random holes in SKSpriteNodes

本小妞迷上赌 提交于 2019-11-30 17:33:39
Aside from the fact that the question asked here : Draw a hole in a rectangle with SpriteKit? has not satisfactorily been answered in its own right, the most significant difference between the two is that this question requires an absence of workarounds and specifically asks about reversing the functionality of SKCropNodes. The primary concerns in this question cannot be addressed by the type of hacky ways the above question could be answered due to the randomness of the holes, the number of holes, and the variation in objects to which the holes are to be applied. Hence the Swiss Cheese

Spawning a Spritekit node at a random time

瘦欲@ 提交于 2019-11-30 10:22:57
I'm making a game where I have a node that is spawning and falling from the top of the screen. However I want to make the nodes spawn at random time intervals between a period of 3 seconds. So one spawns in 1 second, the next in 2.4 seconds, the next in 1.7 seconds, and so forth forever. I am struggling with what the code should be for this. Code I currently have for spawning node: let wait = SKAction.waitForDuration(3, withRange: 2) let spawn = SKAction.runBlock { addTears() } let sequence = SKAction.sequence([wait, spawn]) self.runAction(SKAction.repeatActionForever(spawn)) The code for my

Subclassing SKNodes created with SpriteKit .sks scene file

£可爱£侵袭症+ 提交于 2019-11-30 08:11:34
问题 (this is for XCode 6 and iOS 8 beta 4) Love the new SceneKit editor. I'm successfully loading the scene from .sks file into a custom SKScene class. However, objects inside it are instantiated as default classes (SKNode, SKSpriteNode, etc), and i'm not sure how to bind them to be instantiated as custom subclasses instead. Currently, I'm getting around that by creating custom classes and linking to sprite nodes as a property, and that works ok 回答1: I wrote a little helper delegate to deal with