sprite-kit

SpriteKit: didBeginContact being called non-stop on iPad

徘徊边缘 提交于 2019-12-11 22:34:58
问题 I have a very simple project using SpriteKit where a monster is dropped and walks across a platform. On the iPhone, didBeginContact gets called once when the monster hits the platform. However, on the iPad, the method gets called several times a second as the monster slides across the platform. Why is it fine on the iPhone but buggy on the iPad? I've tested on both the simulator and an actual iPad. Here is where I set up the Categories static const uint32_t playerCategory = 0x1 << 0; static

Handling very fast moving objects in Sprite Kit

依然范特西╮ 提交于 2019-12-11 22:20:02
问题 I have an object that is moving very fast (max velocity 900). When it reaches max speed it starts to create trailing objects or motion blur. But I just want it to be the object moving fast. I am running on 60 fps. I like the speed of the object but I don't like how its getting rendered (motion blur). How do I handle this? This object bounces all around the screen with a restitution of 1.02, because I want to make it pick up speed as it keeps bouncing. I want to make it go faster thats why I

Serious SpriteKit UIColor bug on iPhone 5S

旧巷老猫 提交于 2019-12-11 22:13:57
问题 I've found a serious swift-bug in SpriteKit while working with SKSpriteNodes and their colors. This code works fine on all iPhones beside the iPhone 5S: var color1 = UIColor(red: 123/255, green: 123/255, blue: 123/255, alpha: 1) var color2 = UIColor(red: 123/255, green: 123/255, blue: 123/255, alpha: 1) var sprite = SKSpriteNode(color: color1, size: CGSizeMake(100, 100)) if(sprite.color == color2){ println("Same color") } As you see, the two colors are the absolut same. But on the iPhone 5S

Drawing line with Touch iOS Sprite Kit

为君一笑 提交于 2019-12-11 21:10:00
问题 Im using the following code to draw lines in my sprite kit scene but nothing shows up. But the node counts goes up. Can anyone see what could be the problem. Ive been fighting with this code forever - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; CGPoint positionInScene = [touch locationInNode:self]; pathToDraw = CGPathCreateMutable(); CGPathMoveToPoint(pathToDraw, NULL, positionInScene.x, positionInScene.y); lineNode = [SKShapeNode

Why my node calls didBeginContact method when its not in the Scene

核能气质少年 提交于 2019-12-11 20:07:15
问题 func didBeginContact(contact: SKPhysicsContact) { if contact.bodyA.categoryBitMask == PhysicsCategory.overPow || contact.bodyB.categoryBitMask == PhysicsCategory.overPow{ let sk = delegateForCollision!.view as! SKView let newScene = GG(fileNamed: "GG") newScene!.delegateFor = delegateForCollision newScene?.scaleMode = .AspectFill sk.presentScene(newScene) } if contact.bodyA.categoryBitMask == PhysicsCategory.glem && contact.bodyB.categoryBitMask == PhysicsCategory.kappa{ contact.bodyA.node?

How To Make An Extending Chain

会有一股神秘感。 提交于 2019-12-11 19:55:46
问题 Okay, I have had a few questions floating around stackoverflow now, and most of them are related to this one question. I've been trying to get it myself, and I have a couple of times but the result is never quite what I expected. I am trying to develop a chain that my sprite can throw. So far what I have done is thrown the lead of the hook from the centre of the sprite outward. Once it travels 10 pixels away from the sprites position it generates another link in the chain. The chain is then

Sprite Kit / Objective C : What is the “touch indicator” for objects

一个人想着一个人 提交于 2019-12-11 19:52:40
问题 I am referring to the menu screen of my SpriteKit game. I used image SpriteNodes for the start and options button. I want to change to the "game view" if I touch the start button, and "options view" if the options button's pressed. Should be an easy question, but I couldn't find any resources for this. 回答1: in SpriteKit for detect which SKSpriteNode is touched there is property .name SKSpriteNode *toGame = [SKSpriteNode spriteNodeWithImageNamed:@"game"]; toGame.name = @"toGame"; ...

Sprite Kit - Shadow on multiple moving object affected impulse and Gravity

筅森魡賤 提交于 2019-12-11 19:49:03
问题 Base on my first question here which was answered by Theis Egeberg (The solution was explained more by Theis in the comment and worked like magic)I would need to also know the following: (This might have a simple answer but I will leave it it to Theis or anyone who can figure it out.) What if I have another object bouncing off the the already moving ball in Y axis witch as a different speed ? how do I change alpha of its shadow on the ball. To explain it nicer and make it more confusing, lets

iphone app memory build up

妖精的绣舞 提交于 2019-12-11 19:48:56
问题 Trying to diagnose why my game is building up memory, causing it to eventually slow down to the point of unresponsiveness. Based on previously asked questions, i think i might know what's causing it, not sure though, so i will just post what i think it might be. [self performSelector:@selector(createObstacle0) withObject:nil afterDelay:1.0]; [self performSelector:@selector(score0) withObject:nil afterDelay:1]; .... -(void)createObstacle0 { int yMin = (CGRectGetMidY(self.frame)+190); int yMax

Spritekit how to run a method for a certain amount of time, then start another one

半世苍凉 提交于 2019-12-11 18:38:19
问题 I'm making a game and i'm currently stumped on how to have a method run for a certain amount of time, turn off, then to have another method start running. Currently i have: [self spawn]; when the scene sets up. Here is the spawn method: -(void)spawn { int xMin = 0; int xMax = 460; CGPoint startPoint = CGPointMake(xMin + arc4random_uniform(xMax - xMin),320); [self performSelector:@selector(spawn) withObject:nil afterDelay:.20]; SKSpriteNode *blue = [SKSpriteNode spriteNodeWithImageNamed:@