skaction

Change time interval in SKAction.waitForDuration() as game goes on

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 14:06:36
问题 Basically this is one of the actions in a repeating sequence of actions. Each time the action gets called up in the sequence, i want the waiting time to increase, so i added a counter to act as the waiting time number and increment whenever the action gets called up in the sequence. The problem is with this, is that the variable only increments when the sequence starts, but doesn't change at all when the action happens again in the sequence, The waiting time remains constant throughout the

SpriteKit - How to fix distortion in Node's animation?

一曲冷凌霜 提交于 2019-12-02 09:43:37
I have created an animation of various PNGs, but there are various frames that stretch to the border so the node is 'filled'. The animation should look like the GIF that I have created using the same pictures. Does anybody know how to make the animation look like the GIF? GIF: Gif: Animation should look like this Actual: Extra slow Actual result of the code Border: Here you can see the border of the physics body that has the same size of the "node's border" I have tried to fix the problem by switching the scene.scalemode. Further, I have tried to make the size of the Node dependent on the size

Change time interval in SKAction.waitForDuration() as game goes on

你说的曾经没有我的故事 提交于 2019-12-02 08:19:11
Basically this is one of the actions in a repeating sequence of actions. Each time the action gets called up in the sequence, i want the waiting time to increase, so i added a counter to act as the waiting time number and increment whenever the action gets called up in the sequence. The problem is with this, is that the variable only increments when the sequence starts, but doesn't change at all when the action happens again in the sequence, The waiting time remains constant throughout the game. and i can't figure out how to get it to change when it gets called up var timeInterval = 0 //main

Modify the speed of a running SKAction

 ̄綄美尐妖づ 提交于 2019-12-02 03:09:53
问题 I have this code: @implementation MyScene { SKAction *delayAction; } Inside a method: delayAction = [SKAction waitForDuration:3.0]; [self runAction:[SKAction repeatActionForever: [SKAction sequence: @[delayAction, [SKAction ...]]]]] withKey:@"myKey"]; Then i want to decrease duration overtime. (This method is called on update:) So i tried: - (void)updateVelocity { NSLog(@"duration:%f",delayAction.duration); delayAction.duration = delayAction.duration - 0.001; } And i get: 2014-04-04 11:45:05

Modify the speed of a running SKAction

风流意气都作罢 提交于 2019-12-02 01:59:42
I have this code: @implementation MyScene { SKAction *delayAction; } Inside a method: delayAction = [SKAction waitForDuration:3.0]; [self runAction:[SKAction repeatActionForever: [SKAction sequence: @[delayAction, [SKAction ...]]]]] withKey:@"myKey"]; Then i want to decrease duration overtime. (This method is called on update:) So i tried: - (void)updateVelocity { NSLog(@"duration:%f",delayAction.duration); delayAction.duration = delayAction.duration - 0.001; } And i get: 2014-04-04 11:45:05.781 FlyFish[5409:60b] duration:1.300000 2014-04-04 11:45:05.785 FlyFish[5409:60b] duration:1.299000

Spritekit stopping sound

只愿长相守 提交于 2019-12-01 17:54:00
问题 I'm currently developing a game using Apple's SpriteKit library but I'm unable to stop a sound after is has began playing. I have tried using the listed methods from the documentation in order to stop the Skaction from running but nothing seems to stop the sound from playing. These have been my attempts of trying to stop the sound. //Playing sound action: SKAction *music = [SKAction playSoundFileNamed:@"menu.wav" waitForCompletion:YES]; [musicNode runAction:[SKAction repeatActionForever:

SKAction Works in didMovetoview but doesn't works in Function

廉价感情. 提交于 2019-12-01 14:26:42
I asked this question previously at here but couldn't explain well because I haven't understood this problem very well. But now after exploring and trying to find the solution I understood it more. My main problem is I have a func to check if two players at same position if so then move first player to it's home location which is working fine before but after making it playable by 4 players and their 4 pieces it stopped working now. But if I paste the same code in didmovetoview then it works fine. so no problem in code but some other fundamental problem which I don't understand because this is

Animate an SKSpriteNode with textures that have a size different from the original

扶醉桌前 提交于 2019-12-01 12:44:51
I want to animate an SKSpriteNode using textures from an SKTextureAtlas, using SKAction.animateWithTextures(textures,timePerFrame,resize,restore) . However, the textures in the atlas have a size that is slightly larger than the original texture (it's basically a character moving). When the action is run, the textures are either compressed to fit the original size of the sprite, or recentered when I set resize to false , which changes the position of the character. What I want, though, is for the textures to be anchored at the lower-left corner (or lower-right, depending on the direction) so

AVAudioPlayer and performance issue in SpriteKit game

梦想与她 提交于 2019-12-01 12:29:08
I have problem with AVAudioPlayer and playing the short sounds in my spritekit game. I have quite dynamic game scene and when the user tap into particular element I want to play simple "beep" sound, but I notice that performing sound using AVAudioPlayer cause significant performance issue. My audio files are in .mp3 format. Also I have tried SKAction method (playSoundFileNamed) to perform sound and everything looks almost the same, I noticed the same performance issue. My question is what is the best practice to perform sound in SpriteKit. PS: I tried to find WWDC Adventure spritekit sample

SKAction Works in didMovetoview but doesn't works in Function

落花浮王杯 提交于 2019-12-01 12:28:06
问题 I asked this question previously at here but couldn't explain well because I haven't understood this problem very well. But now after exploring and trying to find the solution I understood it more. My main problem is I have a func to check if two players at same position if so then move first player to it's home location which is working fine before but after making it playable by 4 players and their 4 pieces it stopped working now. But if I paste the same code in didmovetoview then it works