SpriteBuilder timeline autoplay animation not running - ios

I am trying to understand SpriteBuilder.
I am facing problem of autoplay animation; it behaves strangely. I am sure I am missing some steps.
It is running in one case while in other when I load the .ccb file it is not running.
How can I track why autoplay animation is not running in .cbb file when I load it? What am I doing wrong?
And in the same way, the code of
[self.animationManager runAnimationsForSequenceNamed:#"WaitingForOpponent"];
is also not working in the same way. though it works some time.
EDIT
Actually, I found it; it stops working when I get invitation via Game Centre for playing game. In short, if I get UIAlertView from Game Centre all animations of sprite builder stops working.
But I don't know how to tackle that situation.
Thanks.

Well i got the answer how you can achieve it, actually when you get Game centre Push Notification cocos2d: animation stopped
** message
and after that you get message **cocos2d: animation started with frame interval: 4.00.
but it is not actually starting animation
what i did in applicationDidBecomeActive i put that code [super applicationDidBecomeActive:application]; and it solved my problem :)

Related

SpriteKit animation stops unexpectedly

I'm trying to debug a very strange behaviour of SpriteKit animation. It's quite easy to reproduce:
Create a new Game project in Xcode leaving all the options unchanged.
Open GameScene.swift and change line #23 from label.run(SKAction.fadeIn(withDuration: 2.0)) to label.run(SKAction.fadeIn(withDuration: 0.2))
Connect your phone and start a debugging session, observe how the text (Hello, World!) fades in and appears in full brightness. Well, so far, so good.
Stop the application from Xcode and start it again clicking its icon on your phone.
Observe how the text, although visible, is not faded in completely.
I found this trying to understand why my animation just stops half the way when my application loads. I assume that somehow the view stops refreshing if some initialisation step is longer than the animation but I don't know how to fix this. I also noticed that if you click on the screen it refreshes and the animated view appears in the final state.
iOS version: 10.3
I've discovered a serious issue with iOS11 and SpriteKit. The Game Scene during the transition is getting paused automatically (but only in iOS11).
After transitioning to the scene run
myScene.isPaused = false
and it should fix the issue, and should have no adverse affects when the game is run on iOS10

SpriteKit 40.0 FPS/Performance issue

I have created a spriteKit game and have a problem with performance issues.
Problem:
FPS gets stuck at 40.0
How and when does it happen
1. I have a pause function in my game by just using view!.scene?.paused = true Sometimes when I hit the home button, launch another app, then go back to the game the FPS gets 'stuck' at 40 and doesnt climb back up to 60.0. (Sometimes it does)
2. I have a 'sharing' Facebook and Twitter icon where when you tap on it you can post/share/tweet something on your account. This icon can be seen in the pause menu. After posting or returning back to the game FPS gets stuck at 40 FPS (And again, sometimes it does climb back up to 60. Sometimes it does not)
3. To clarify, this doesnt happen mid-game. This only happens if I minimize the app, launch the Facebook/Twitter icons, during reminder pop-ups.
Temporary fix
There is a temporary fix to this, which is to minimize the app and then launching it again. However, I wouldnt want my users to experience this at all. If possible Id like to eliminate this problem altogether.
What I have tried so far to fix this
1.Ive tried running this on instruments (time Profiler) but nothing really caught my eye. Thought I have to say I am quite new with instruments.
2. There is a similar question here but for him disabling UIKit items fixed it for him, and I dont have any of that.
3. I initially thought it was a SKShapeNode issue so I changed my sprites to SKSpriteNode. No help here either.
4. I have tried without the USB cable attached to the phone and tried running it using the Run button on XCode. No difference.
5. Ive tried rebooting device and laptop. Didnt help.
6. Tried this on multiple devices. Same issue.
Stats?
Game typically starts out at 20 nodes and 5 draws and can go up to 60 nodes 6 draws but it will actually still run smooth as long as I dont initiate any of the triggering methods mentioned above.
I have spent alot of time trying to find a solution for this. Changing codes and streamlining it. Googling it. I really need help on this one. I would really appreciate some help.
Update for comment #1
For you first inquiry
1) I have a SKSpriteNode as the pause button during gameplay for the user to pause the game if he wants to.
2) I have func applicationWillResignActive(application: UIApplication) {} in my AppDelegate.swift file that triggers a GameScene.swift function that changes a flag from true to false so that I know when the user goes out and come back in again. And I have my update block searching for that flag. If it is true, display the pause menu. However, this 40FPS issue happened before I added this whole pause/unpause thing. (The 40 FPS issue is what made me create the pause menu for this) (I know too in the latest ver. of swift that it will auto-pause when the app is minimized and unpause when I bring it back up.)

Animation in Launch Screen in xcode 6

I want to animate a set of images in my Launch Screen, but I do not know how. I have seen some tutorials telling me to put code in the App Delegate (DidFinishLaunchingWithOptions) and nothing has worked.
Could someone help me animate my Launch Screen?
I am supposing that you do quite a bit of work on launch, and you do not want your user to stare at a static image while this work is going on. What you need to do is do the work in the background (using gcd). This way, the launch screen will be gone quickly. However, you are not ready of course: hence your need for animations. So what I do is add my own equivalent of the start screen on top of my first visible UIView, do my animations and then tear down my start up screen. If you want to see what I do in action, try it out with my App (The Opera Player)

is there any way to detect an object is falling or get the speed/direction on axis-y in cocos2d?

I'm a newbie to Cocos2d and game development. Now I'm encountering a problem.
I have a figure and I want to add different animations to it such as jump and fall. For the jump it is fine because I will have a button to trigger jump and I can add animation to it. However, for falling down is another story:
At the beginning, I'm trying to use - (void) update() and it seems this method is for constant moving. Another attempt is try to add a callback for CCAction. However, this can only detect falling after jump.
I'm wondering is there an API to detect an object is falling, or get the speed/direction on axis-Y. Or I have to do it manually and listen frame by frame?
I really appreciate your help =)

iAds and SpriteKit: SKScene Freeze on fullscreen exit on device only

My issue is similar to this one here
iAd freezes game's scene, but I feel the issue hasn't been resolved.
I have an iAd in it's own view overlayed over an SKScene so that it doesn't affect the SKScene sizing. The banner functions correctly but on fullscreen exit the SKScene is frozen. App is still receiving touch inputs, verified via NSLogs. If I click the banner again though and exit fullscreen the second time around the SKScene is no longer frozen. Why?
It's important to say that this happens only when testing on a device (iPhone5). On the simulator, there are no issues. Has anyone figured out this conundrum?
Issue is similar to this post iAD View Freezes On Ad Close but the solution: 'Remove self.canDisplayBannerAds = YES' doesn't work for me.
While I've tried creating it programatically also, I've implemented the iAd via storyboard, and this is not relevant.
The issue is also here iAd Freezes App iPhone 5[s][c] but the solution is short of superstition and still remains a mystery.
--
The alternative solution to implement an iAd with SpriteKit via self.canDisplayBannerAds and originalContentView works and functions correctly but produces a sizing/scaling issue as it shares the view with the SKScene (Spritekit iAds messing with scene size) which I'd rather avoid, but am willing to use smoke and mirrors to hide the ugly resizing animation/effect as a last resort.
--
If anyone knows the best way to implement an iAd with SpriteKit without sizing issues or freezing issues on device please let me know.

Resources