sprite-kit

contacts not recognized when body is changed from circle to rectangle

孤人 提交于 2019-12-20 04:55:56
问题 With help from here I have made a circle body traverse a given path. I have some bodies at some of the path points and have logged contact in didBeginContact . When the body gets in contact with a specific body the circle body is changed to a rectangle. This rectangular body is suppose to traverse the same path as the original circle body but it doesn't reach the path points as the contact is not logged. I tried changing radiusPoint to the width or height of the rectangle also but that didn't

iAd's with Swift in SpriteKit

烈酒焚心 提交于 2019-12-20 04:54:43
问题 I am working on an app and would like to include iAd's. I have managed to add banner ad's and they work well. However i want to a larger add that fills most of the screen but not full screen. I added the adBanner using code from Benzene's Question and given solution from erdekhayser. Apple iAd Documentation (Page 3) The link i have referenced above is from the apple documentation and apple refer to the iAd as an MREC ad. This is what i would like to have. I cannot work out how to create and

SKLabelNode will disappear but is still clickable

若如初见. 提交于 2019-12-20 04:28:21
问题 I am making a game using SpriteKit and Swift, running Xcode 6. I have an SKLabelNode , let's call it myLabelNode for this example. When I call myLabelNode.removeFromParent() it removes the node from the scene, as it should. The node count drops by 1, and it isn't visible anywhere on the screen. However, when I click the spot where myLabelNode previously was, my program will still call out the function that should only happen when myLabelNode is touched. I also tried combining myLabelNode

passing info from collectionView to gameScene

雨燕双飞 提交于 2019-12-20 04:20:50
问题 I have created a game using SpriteKit (GameScene and GameViewController) and Objective-C. Everything there works fine. Within the same App I have created a UIViewController and a second viewController in storyboard that uses CollectionView. I have the collectionView loading the array. I want to be able to tap on a collectionView Cell and have it open the gameView. Which I can do. However I would like to pass some information from the collectionView to the GameScene so I can load the

Swift 3.0 save a score with SpriteKit

﹥>﹥吖頭↗ 提交于 2019-12-20 04:16:30
问题 I am trying to save a "highScore" integer that persists after the app is closed using SpriteKit. That's it. Just one single integer on one single screen that I will eventually set with my game whether or not the new score is higher than the saved score. I understand that there are a lot of options already on stackoverflow for this, however they are all for versions of Swift less than 3.0. They use a bunch of methods and built-in functionality that I don't understand as a beginner. After

Moving an object across the screen at a certain speed.(Sprite Kit)

不问归期 提交于 2019-12-20 03:56:15
问题 I have an object that needs to move up and down the screen. When you first click it moves down the screen to an endpoint with a duration of 3 seconds. You can click at anytime to stop it from moving down and make it start moving up to a different endpoint, again at a duration of 3 seconds. The problem with doing it this way is if you click to move the object down but then immediately click again to move it up, the object moves up but at a very slow rate because it has a duration of 3 seconds.

iOS SKSpriteNode - Leave screen

纵然是瞬间 提交于 2019-12-20 03:32:23
问题 Is there any way to remove from Parent a SKSpriteNode that has left area bounds? for instance: -(void)didBeginContact:(SKPhysicsContact *)contact { firstNode = (SKSpriteNode *)contact.bodyA.node; if (firstNode.position.y<0) { [firstNode removeFromParent]; } } Just point me in the right direction. Is it the update method enumerate through checking their rects or is their an action you can apply. I have gone through the documentation can't seem to find it but I would have thought it would be an

How to present UIAlertController from SKScene

廉价感情. 提交于 2019-12-20 03:14:51
问题 I'm working in Spritekit and I'm trying to present a UIAlertController from my SKScene, but I am having trouble doing it. I've watched several tutorials but none of the UIAlertController tutorials have been specific to Spritekit. I keep seeing this code below, but it has not been effective since SKScene is not a UIViewController. [self presentViewController:self animated:YES completion:nil]; I have the rest of the relative code below. Can anybody please help me present my UIAlerController on

How to make sprite sit on a moving sprite

亡梦爱人 提交于 2019-12-20 03:08:38
问题 How to make a sprite sit on a moving sprite and travel with it. I have made the red box jump with impulse and when it falls on the black block down which is moving, the red box stays were it dropped slips the moving object like there is no friction. Conditions gravity on, friction 1.0 in both even tried increasing the mass, but nothing worked. Please give me any details how to make it work ? thanks override func didMoveToView(view: SKView) { /* Setup your scene here */ self.physicsWorld

How to compare SKSpriteNode textures

寵の児 提交于 2019-12-20 02:42:28
问题 I am making a game with Sprite Kit. When there is a collision I would like to retrieve the image of the SKSpriteNode that my projectile collided with to assign different point values depending on the image of the monster. I think comparing the texture property of the SKSpriteNode could work. I have tried the following code, but my if statement is never called. Any suggestions? - (void)projectile:(SKSpriteNode *)projectile didCollideWithMonster:(SKSpriteNode *)monster { SKTexture *tex =