sprite-kit

libc++abi.dylib: terminating with uncaught exception of type NSException - SpriteKit

南楼画角 提交于 2019-12-08 10:17:30
问题 I am creating a game, where I run my app once and I get this type error: libc++abi.dylib: terminating with uncaught exception of type NSException Here is the image: The Image Build Phases My Build Phases 回答1: If your using latest Xcode remove the library libc++abi.dylib from build phase and add libc++abi.tbd Hopes this will fix the issue. 回答2: I have faced the same issue. Check the name of the Storyboard identifier inside the Identity Inspector and make sure you use the same name. (A good

Swift SKScene shows as blank in Objective-C project

不羁岁月 提交于 2019-12-08 10:02:41
问题 I have an Objective-C based project in Xcode. I'm trying to add a SpriteKit scene as a smaller view in a view controller. The SpriteKit files are in swift though. I've added Floor1.sks and linked it with Floor1.swift. Now I'm trying to load it into my Objective-C ViewController.m file. In my storyboard I made the view to the class SKView, and I think I properly made a bridging-header file. My code to insert it at the moment is: GKScene *scene = [GKScene sceneWithFileNamed:@"Floor1"]; Floor1

Why does collision work properly for convex polygon based physicsBody but touchesMoved doesn't

青春壹個敷衍的年華 提交于 2019-12-08 09:33:21
问题 I setup an SKSprite (s1) to have physicsBody with polygon from path: s1.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path]; and the other one (s2) has physicsBody generated from its surrounding rectangle: s2.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:e.size]; and the collisions of the two sprites are fine, they only happen when the actual pixels from the s1's polygon path and surrounding rectangle from the s2 collide (and not the surrounding rectangles from each of the

GameScene Share Button

让人想犯罪 __ 提交于 2019-12-08 09:21:19
问题 my game is pretty much ready to go, the only thing I am missing (and would like to add) is the option to share a standard message to social media. I have looked around and found different ways of doing this but none of them seem to work when I implement them. I've got a feeling it might be something simple that I'm doing wrong! Here's my button: func createShareButton() { shareButton = SKSpriteNode(imageNamed: "shareBtn") shareButton.size = CGSize(width: 240, height: 55) shareButton.position

SKAction to follow Circle CGPathRef in clockwise direction

女生的网名这么多〃 提交于 2019-12-08 09:03:35
问题 My SKSpriteNode follows this path in a counterclockwise direction, how do i make it so it follows the path in a clockwise direction? Thanks in advance! CGPathRef circle = CGPathCreateWithEllipseInRect(CGRectMake(0,0,50,50), NULL); SKAction *followTrack = [SKAction followPath:circle asOffset:YES orientToPath:YES duration:5.0]; SKAction *forever = [SKAction repeatActionForever:followTrack]; [player2 runAction:forever]; 回答1: Instead of CGPathCreateWithEllipseInRect() , use CGPathCreateMutable()

Need objects to move with a constant speed

℡╲_俬逩灬. 提交于 2019-12-08 08:52:28
问题 I'm trying to create a game, where the objects need to chase food. Right now the objects speeds up, when the food is within the given radius. But I need the speed to always be the same. Any suggestions how to fix this? I have tried to add an SKAction under the chase function, where I set the position.x and position.y, but I can't make it work correct. Fish class: class Fish:SKSpriteNode{ private let kMovingAroundKey = "movingAround" private let kFishSpeed:CGFloat = 4.5 private var

In app purchase in SKScene not working?

家住魔仙堡 提交于 2019-12-08 08:49:12
问题 I'm creating a SpriteKit game in Swift and I'm trying to implement in app purchases. I followed this question here: in app purchase in SKScene And here is my code: In didMoveToView: // Set IAPS if(SKPaymentQueue.canMakePayments()) { println("IAP is enabled, loading") var productID:NSSet = NSSet(objects: "GameOverSaveSavior") var request: SKProductsRequest = SKProductsRequest(productIdentifiers: productID as Set<NSObject>) request.delegate = self request.start() } else { println("please enable

iOS Sprite Kit how to reflect a sprite horizontally? [duplicate]

只愿长相守 提交于 2019-12-08 08:39:11
问题 This question already has answers here : Horizontally mirror a SKSpriteNode texture (4 answers) Closed 5 years ago . Is there a way to create a SKSpriteNode and pass it an image name, but have it reflect the image horizontally? 回答1: You mean you want to flip the image? node.xScale = node.xScale * -1; or node.yScale = node.yScale * -1; 来源: https://stackoverflow.com/questions/21008886/ios-sprite-kit-how-to-reflect-a-sprite-horizontally

Adding UITextView to a scene in SpriteKit

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 08:36:40
问题 I trying to create a game, and following Apple's advice I am using multiple scenes. You could consider the game to be a text heavy point and click adventure. Therein lies the problem. Lots of text, having done a bit of a search, it seems the recommend way, or rather the current only way to do this is with a UITextView thus: [self.view addSubview: textView]; This is all well and good if you only have one SKScene , as that is the scene being displayed by the current view/SKView. My problem is,

SpriteKit Camera position correction in iOS10?

只谈情不闲聊 提交于 2019-12-08 08:20:31
问题 When converting my App, which has a SpriteKit scene in it, to iOS 10 I have had to convert my scene's original camera position from: cameraNode.position = CGPoint(x: self.size.width/2, y: self.size.height/2) to account for iOS10 with: if #available(iOS 10, *) { cameraNode.position = CGPoint(x: self.size.width/2, y: (self.size.height + voidSize)/2) } else { cameraNode.position = CGPoint(x: self.size.width/2, y: self.size.height/2) } The iOS10 version actually makes more sense as I do have part