sprite-kit

How to Combine SKTextures

ε祈祈猫儿з 提交于 2019-12-11 09:31:11
问题 I'm looking for a way to combine an SKTexture on top of another SKTexture, similar in appearance to how a textured SKSpritenode would look when adding another textured SKSPritenode as a child. I need it to be a single SKTexture as an end-product please. 回答1: The short of it is that you can't do it. A SKSpriteNode can only ever take one SKTexture. The only way to do this within the SpriteKit framework is to add children on top of the parent node. Another way is to use a series of images and

Xcode linker command failed with exit code 1

心不动则不痛 提交于 2019-12-11 08:55:13
问题 I'm having an annoying problem with Xcode. I can't run the projects and it gives me back the same error every time: ld: file not found: /Users/DagDigg/Library/Developer/Xcode/DerivedData/Roundy2-dtzcccrlvjvoxsapfbdzchhtuivr/Build/Intermediates/Roundy2.build/Debug-iphoneos/Roundy2.build/Objects-normal/arm64/AppDelegate.o clang: error: linker command failed with exit code 1 (use -v to see invocation) I'm unable to run every project. Even if I create an empty one... I'm using Xcode 7 beta 3 and

How do I get rid of SKTextures?

吃可爱长大的小学妹 提交于 2019-12-11 08:35:07
问题 Maybe this is easy, but I'm lost. I have a project where I have to make a full-screen animation that uses 8 jpgs to simulate a page opening. So what I am doing is: I have an SKSpriteNode that displays on the full screen making an array of 8 SKTextures using SKTexture preloadTextures to load them once they're loaded, I use animateWithTextures to show the animation later on, another method removes the SKSpriteNode from the scene. When I first do the page turn, it uses a ton of memory, but when

How do I get xcode to run the code in GameScene.swift instead of GameScene.sks [closed]

三世轮回 提交于 2019-12-11 08:33:53
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . How is it possible to get xcode to run the code inside of the GameScene.swift instead of GameScene.sks? 回答1: Everything is in GameViewController if let view = self.view as! SKView? { // Load the SKScene from 'GameScene.sks' if let scene = SKScene(fileNamed: "GameScene") { // Set the scale mode to

App crashes on iPhone 4s but no other device: possible issue with SKPhysicsContactDelegate?

自古美人都是妖i 提交于 2019-12-11 08:27:32
问题 I've ran my spritekit game on the following devices: iPhone 5s, iPhone 4s, iPad air and iPad mini. The app runs and all the devices except the 4s. On the 4s the app crashes when the app transitions to scenes that include SKPhysicsContactDelegate, for example: class PlayScene: SKScene, SKPhysicsContactDelegate, ADBannerViewDelegate { enum ColliderType: UInt32 { case narrowCategory = 1 case bigCategory = 2 case smallCategory = 4 case roundCategory = 8 } var narrow = SKSpriteNode(imageNamed:

SKSpriteNode position

旧巷老猫 提交于 2019-12-11 08:09:11
问题 I am trying to (learn how to) build a game using SpriteKit and i ran into a problem that has been bugging me for hours. I have a class named Tank with the following constructor: + (instancetype)tankAtPosition:(CGPoint)position { Tank *tank = [self spriteNodeWithImageNamed:@"tank_base_1"]; tank.position = position; tank.anchorPoint = CGPointMake(0.5, 0.5); return tank; } In my scene i have the following constructor: -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) {

Can you save the position of a node in an sks file

烂漫一生 提交于 2019-12-11 08:08:52
问题 I'm trying to create a SKScene file where we create empty nodes at the places where our players and other objects will be placed. The problem is that the positions all have to be set in code. Is it possible to set the position in the sks file instead? I did notice there is a Position label in the node inspector, but that doesn't appear to have any effect. 回答1: Write data with NSUserDefaults: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *nodeDict = [

Could not create physics body - Swift

吃可爱长大的小学妹 提交于 2019-12-11 07:44:57
问题 I have a Swift file called ChainsawMaker.swift which I want to use to create chainsaws throughout my game. When I call instances of this and add it to my game, the chainsaws and it's physics body get added to the game perfectly - except for an error that pops up in the console: "Physics Body: Could not create physics body". Here is the code for ChainsawMaker.swift: import SpriteKit class ChainsawMaker: SKSpriteNode { func longChainsawCreator2 () -> SKSpriteNode { //LONG CHAINSAW let

iOS7: How to wait for requestInterstitialAdPresentation to finish

ぃ、小莉子 提交于 2019-12-11 07:42:37
问题 I have implemented a method on my view controller (via a protocol) which my game engine calls to present Interstitial advertisements. I want to prevent the control loop from returning to the caller while a full screen advertisement is in play, and not affect subsequent animations of SKScene objects happening while the ad cleans up and delays processing. I have achieved this with the following code, which checks if an advert will be presented, and blocks the current thread until the advert is

On iOS, can you add multiple CIFilters to a SpriteKit node?

南楼画角 提交于 2019-12-11 07:33:29
问题 On iOS, can you add more than one CIFilter to a SKEffectsNode ? CIFilterGenerator seems like what I want but it isn't available on iOS. I know you can use multiple filters on an image by passing the output of one as the input of the next, but that's not helpful if you want to affect non-image nodes. Does this mean I have to create an artificial hierarchy of SKEffectNode and add a filter to each of them, with my actual content at the very bottom? Is there a better way? 回答1: Where it's