sprite-kit

Make SKSpriteNode flash white with SKAction colorizeWithColor

百般思念 提交于 2020-02-03 08:14:08
问题 Ok so I have a sprite thats suppose to flash white when hit by something, I'm using this SKAction *changeColorAction = [SKAction colorizeWithColor:[SKColor whiteColor] colorBlendFactor:1.0 duration:1]; What happens is the sprite flashes, but instead of white, it just turns transparent. If I use any other color like redColor, blueColor, ect.. It works perfect. How can I get it to actually turn white? Thanx for the help!!! :D 回答1: Colorize with white should give you the image's original colors.

SKView warning logs

a 夏天 提交于 2020-02-02 02:33:27
问题 When running my SwiftUI & SpriteKit app, I get the following messages in the logs: 2019-11-18 21:58:57.631912+0000 PixelBattles[2812:1215803] SKView: ignoreRenderSyncInLayoutSubviews is NO. Call _renderSynchronouslyForTime without handler What am I doing wrong to receive this log, and should I worry about it? Could it be a bug? Could it be that SwiftUI cannot figure out how to do the layout for an SKView ? Major edit: If you need code, you can see it in the previous edits. Below I state why I

SKView warning logs

给你一囗甜甜゛ 提交于 2020-02-02 02:32:36
问题 When running my SwiftUI & SpriteKit app, I get the following messages in the logs: 2019-11-18 21:58:57.631912+0000 PixelBattles[2812:1215803] SKView: ignoreRenderSyncInLayoutSubviews is NO. Call _renderSynchronouslyForTime without handler What am I doing wrong to receive this log, and should I worry about it? Could it be a bug? Could it be that SwiftUI cannot figure out how to do the layout for an SKView ? Major edit: If you need code, you can see it in the previous edits. Below I state why I

SpriteKit Pause and Resume SKView

做~自己de王妃 提交于 2020-01-29 22:34:46
问题 I want to Pause and Unpause a Scene in SpriteKit, with 2 Buttons on the same position. While the Scene is running, I want to show the 'Pause' Button. While the Scene is paused, I want to hide the 'Pause' Button and show the 'Play' Button. In SpriteKit you can use self.scene.view.paused which is defined in SpriteKit. My Code: @implementation MyScene { SKSpriteNode *PauseButton; SKSpriteNode *PlayButton; } -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { [self Pause]; }

SpriteKit Pause and Resume SKView

陌路散爱 提交于 2020-01-29 22:30:52
问题 I want to Pause and Unpause a Scene in SpriteKit, with 2 Buttons on the same position. While the Scene is running, I want to show the 'Pause' Button. While the Scene is paused, I want to hide the 'Pause' Button and show the 'Play' Button. In SpriteKit you can use self.scene.view.paused which is defined in SpriteKit. My Code: @implementation MyScene { SKSpriteNode *PauseButton; SKSpriteNode *PlayButton; } -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { [self Pause]; }

SpriteKit Pause and Resume SKView

折月煮酒 提交于 2020-01-29 22:30:51
问题 I want to Pause and Unpause a Scene in SpriteKit, with 2 Buttons on the same position. While the Scene is running, I want to show the 'Pause' Button. While the Scene is paused, I want to hide the 'Pause' Button and show the 'Play' Button. In SpriteKit you can use self.scene.view.paused which is defined in SpriteKit. My Code: @implementation MyScene { SKSpriteNode *PauseButton; SKSpriteNode *PlayButton; } -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { [self Pause]; }

SKColor comparison works in simulator not on iPhone 5s, and with standard colors not custom ones

♀尐吖头ヾ 提交于 2020-01-26 02:44:23
问题 The following code fails on an iPhone 5s, meaning it reaches the else case, but works fine in the simulator. It also works fine if we use standard colors for red and blue (i.e., SKColor.blueColor(), SKColor.redColor()) let BlueColor = SKColor(red: 0/255.0, green: 185/255.0, blue: 252/255.0, alpha: 1.0) let RedColor = SKColor(red: 250/255.0, green: 50/255.0, blue: 53/255.0, alpha: 1.0) let dot = SKSpriteNode(imageNamed: "dot50") dot.colorBlendFactor = 1.0 dot.color = BlueColor if (dot.color ==

Iterate All Sprite Nodes in SpriteKit using Swift [closed]

半腔热情 提交于 2020-01-26 02:30:13
问题 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 3 years ago . What is the best approach to iterate all SKSpriteNodes in a Scene using Swift? 回答1: If your sprites have their name properties set, you can use enumeration closure: self.enumerateChildNodesWithName(spriteName) { node, stop in // Do something with node. } 回答2: I figured it out

iAds and SpriteKit: SKScene Freeze on fullscreen exit on device only

烈酒焚心 提交于 2020-01-25 03:41:31
问题 My issue is similar to this one here iAd freezes game's scene, but I feel the issue hasn't been resolved. I have an iAd in it's own view overlayed over an SKScene so that it doesn't affect the SKScene sizing. The banner functions correctly but on fullscreen exit the SKScene is frozen. App is still receiving touch inputs, verified via NSLogs. If I click the banner again though and exit fullscreen the second time around the SKScene is no longer frozen. Why? It's important to say that this

Different node position in screen and value

醉酒当歌 提交于 2020-01-25 00:57:26
问题 I'm getting trouble trying to make the enemies in my game shoot bullets. The problem is the bullet texture doesn't appear to originate from the enemy texture. The bullet texture appears really far from the enemies' position. See the image below to understand what I'm talking about. However, the hero-main character can shoot normally and the bullet texture works fine. I imagine that the problem is in the collision interaction, the enemies' textures are kept right between the walls but the the