skaction

iAd banner unpauses spritekit game

安稳与你 提交于 2020-01-17 04:23:47
问题 I am developing an iOS game using sprite kit with an iAd banner, and this iAd is causing the game to unpause itself, and by unpausing I mean SKActions are continuing, here are some details: 1) I have several objects in my game that have a sequence (in series not parallel) of SKActions. 2) clicking the 'pause game' button on my game's screen and 'resuming' work fine - everything is pauses as desired. NSLog statement in "Note" below not displayed. 3) I've coded the following notification which

iAd banner unpauses spritekit game

蹲街弑〆低调 提交于 2020-01-17 04:23:07
问题 I am developing an iOS game using sprite kit with an iAd banner, and this iAd is causing the game to unpause itself, and by unpausing I mean SKActions are continuing, here are some details: 1) I have several objects in my game that have a sequence (in series not parallel) of SKActions. 2) clicking the 'pause game' button on my game's screen and 'resuming' work fine - everything is pauses as desired. NSLog statement in "Note" below not displayed. 3) I've coded the following notification which

How can I prevent SKAction sequence restarting after decoding?

隐身守侯 提交于 2020-01-13 16:20:26
问题 My app is a SpriteKit game with application state preservation and restoration. When application state is preserved, most of the nodes in my current SKScene are encoded. When a node running an SKAction is encoded and decoded, the action will restart from the beginning. This appears to be standard SpriteKit behavior. For me, this behavior is most noticeable for SKAction sequence . On decoding, the sequence restarts, no matter how many of its component actions have already completed. For

Can I move dynamic physics bodies using SKAction when only contact detection is needed?

蓝咒 提交于 2020-01-13 06:28:06
问题 I am looking at tutorial where things are defined like this: planes are sprites with dynamic physics bodies plane moving is done with actions by following the path there is contact detection between bullet and plane bullet is sprite and it has physics body set to be static (which is little unusual in my opinion) Here is the link to tutorial for more information. Questions: When we use actions to move physicsBodies is there a difference how we set body's dynamic property? Because bullet is

Run SKActions sequence with different nodes

时光毁灭记忆、已成空白 提交于 2020-01-11 08:50:40
问题 I know that I can create an SKAction.sequence which will run the actions of one node one by one. But how can I do that if I want to do a sequence with different nodes. I'd like to do something like that: Run action from node A wait 2 seconds Run action from node B. 回答1: If both nodes are uniquely named and are children of the same node, you can use runAction:onChildWithName: , as follows: SKAction *action = [SKAction sequence: @[[SKAction runAction:[SKAction moveTo:CGPointMake(200.0f, 200.0f)

Moving SKSpriteNode to location of the touch

◇◆丶佛笑我妖孽 提交于 2020-01-11 04:15:28
问题 Above is an image of my game. A top-down game. Wherever on the screen the player touches, I want the bullets to go to that location with a duration. I also want the player to be able to drag around his finger on the screen, and the same thing happens. So that the player doesn't have to touch the screen everytime he wants to shoot. I've tried some different stuff so far but nothing seems to work. First off, I dont know if I should have a separate function for the bullet. But anyway, this is my

SKAction.moveToX repeat with value change

女生的网名这么多〃 提交于 2020-01-06 15:17:47
问题 i want to be able move the ball with pause every 20 pixels moved i tried this one but didn't do nothing, the ball stays at the point where it started it doesn't move to the end of the screen,i know i didn't put the waitForDuration , because i wanted to check if it will move or not func spwan() { let ball:SKSpriteNode = SKScene(fileNamed: "Ball")?.childNodeWithName("ball") as! SKSpriteNode ball.removeFromParent() self.addChild(ball) ball.name = "spriteToTrack" ball.zPosition = 0 ball.position

iOS Sprite Kit: How to make Sprite follow Touches

两盒软妹~` 提交于 2020-01-02 17:48:32
问题 I'm new to Sprite Kit and I'm wondering how you can make a sprite follow the touches. For example, my player sprite is on the bottom of the screen. When I tap on the top of the screen, the player sprite should move to the touch point with a certain speed - and if I move my finger it should always be pointing towards the touch point. This is how I tried to implement it: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { CGPoint location = [touch

iOS Sprite Kit: How to make Sprite follow Touches

给你一囗甜甜゛ 提交于 2020-01-02 17:47:49
问题 I'm new to Sprite Kit and I'm wondering how you can make a sprite follow the touches. For example, my player sprite is on the bottom of the screen. When I tap on the top of the screen, the player sprite should move to the touch point with a certain speed - and if I move my finger it should always be pointing towards the touch point. This is how I tried to implement it: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in touches) { CGPoint location = [touch

Stopping an running SKAction - Sprite Kit

百般思念 提交于 2020-01-01 08:36:09
问题 The following code will animate a rotation. let something:SKSpriteNode = SKSpriteNode() func start(){ let rotateAction = SKAction.rotateToAngle(CGFloat(M_PI), duration: 10.0) something.runAction(SKAction.sequence([rotateAction])) } Now I want to stop the animation within the animating duration. Is there anything similar to the following? I want to stop the animation when the user touches the screen. func stop(){ something.SKAction.stop() } 回答1: You just have to use either: something.paused =