sprite-kit

-mouseMoved OSX does not get called in a sprite kit SKScene

核能气质少年 提交于 2019-12-07 09:44:23
问题 The following responder (defined in NSResponder) does not get called in an SKScene in OSX: -(void) mouseMoved:(NSEvent *)theEvent { DLog(@"TEST"); } I have said the window to accept mouse moved events in the app delegate. _window.acceptsMouseMovedEvents = YES; Thank you in advance. SOLUTION: Add to the app delegate: _window.acceptsMouseMovedEvents = YES; [_window makeFirstResponder:self.skView.scene]; 回答1: Add to the app delegate: _window.acceptsMouseMovedEvents = YES; [_window

Create water(fluid) surface with Sprite Kit [closed]

China☆狼群 提交于 2019-12-07 07:51:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . How can i create water surface with Sprite Kit ? I have searched and found help for Cocos2d which uses box2d to create physics effects for water like object floating over water and some part of it in water and other outside of water. Objects going down the water with as force as

Swift SKSpriteNode: Detect Tap / DoubleTap / LongPress

不羁岁月 提交于 2019-12-07 06:56:25
问题 I'm attempting to create a subclass of SKSpriteNode which can detect user interaction (tap, double tap and hold), then defer to a delegate. This seems to me like a relatively common need, but: The code is incapable of detecting a double-tap without also triggering a single-tap. I haven't found a way to detect hold/long-press actions at all. Am I going about this all wrong? I can't help feeling that SpriteKit should have something standard to handle something so basic. I know there's

SpriteKit Particle Emitter Not Appearing in Xcode Editor

跟風遠走 提交于 2019-12-07 06:18:20
问题 I'm having a constant issue of particle effects not appearing in the editor. Everything works fine when I first create them, but after some time they stop appearing. I just see the black background, but the particles aren't there. The only way I'm able to deal with this problem is to delete the node and create a new particle node with the same attributes, which is time consuming and annoying. And then, after a while, the same thing happens to the new particle nodes. Anyone else experience

Playing back video in an SKVideoNode causes a black flash before playback begins

一笑奈何 提交于 2019-12-07 05:48:00
问题 I'm using Sprite Kit and an SKVideoNode to play back a short video. When the video node is added to the scene, be that before of after the initial set up, the player flashes black for a brief second. I have tried using an AVPlayer for the video instead of the video directly, also I've used KVO to only load the SKVideoNode when the video says it's ready to play. Either way I get a black flash before my video starts to play. Also there doesn't seem to be a way to add an AVPlayerLayer to the

Loading an SKNode from a .sks scene file in Swift

天涯浪子 提交于 2019-12-07 05:19:22
问题 I want to use multiple .sks files to store some complex SKNode hierarchies such as game menus. I have a background with moving objects I'd like to keep throughout the game, so presenting different SKScenes doesn't achieve what I want. I am restricted to one scene, but I'd still like to separate out my code from artwork as much as possible, and trying to squeeze everything into one .sks file gets crowded quick! So I'd like to have multiple .sks files, each one storing a different menu:

Sprite Kit app crashes when run on real device and plugged into computer

走远了吗. 提交于 2019-12-07 05:09:31
问题 I just updated to iOs10 on my test phone and XCode 8. I ran the code migration and was running tests succeessfully on my simulated devices. However, once I started trying to test on my real device things stopped working smoothly. After running my Sprite Kit game for around 5 - 10 seconds it would crash and render the phone inoperable until I unplugged it from the computer. After I unplug it the game runs as normal and is still really smooth. This are the startup notifications printed to the

Sizing and scaling SKSpriteNode

柔情痞子 提交于 2019-12-07 04:18:47
问题 I have multiple game objects in my iOS game, some of which have a greater resolution than others. The graphics to use for the game object is chosen randomly at runtime. I'd like to make sure that they all don't go over a certain size when used, so I devised the following algorithm: while self.spriteNode.rSize.width > 100 && self.spriteNode.rSize.height > 100 { self.xScale -= 0.01 self.yScale -= 0.01 } where spriteNode is the object whose texture is the graphic and rSize is an extended

Specify random particle start colour with no animated change?

时光怂恿深爱的人放手 提交于 2019-12-07 03:26:50
问题 Is there a way to have particles spawn with a random per particle colour based on the current "Color Ramp"? The particles do not change colour over their lifespan, they are simply assigned a colour from somewhere along the "Color Ramp" at birth and keep that colour until they die. The result of this would be a mix of particles at birth with blend colours from RED through to BLUE. In my tests I only seem to be able to get the behaviour where particles spawn as RED and then gradually turn to

Jumping to a specific SKNode in node hierarchy

♀尐吖头ヾ 提交于 2019-12-07 03:22:34
问题 I have noticed that the SKNode methods children and childNodeWithName: as the name implies only return results from the children directly below the queried node. i.e. [root children]; will return an NSArray containing the nodes @[CUBE1, CUBE2, CUBE3] . In the diagram below I want to get from the ROOT (SKScene) level down to SPHERE2 so that I can quickly access that nodes children. I was hoping that [root childNodeWithName:@"SPHERE2"]; would traverse the whole hierarchy and return a pointer to