且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS9 Sprite Kit问题

更新时间:2023-01-06 07:43:05

由于@ tobias-lott在他的评论中提到,我不得不将zPosition包含在每个Sprite中,而不是让代码对sprite进行排序。


Everything was going so well until I upgraded to xCode 7 and iOS 9....

My current project is a 2D platform game, ever since the upgrade I've fallen fowl of the sprite kit bug/errors that many of us seem to be facing.

My issue is that all sprites appear randomly in terms of their zPosition position each time the game runs on either simulator or device. I've been scouring stack for an answer without luck, so far I've tried.

  • Moving all images to .xcassets Like described here
  • Changing the iOS Development Target to iOS 9.0 under Build Settings
  • Changing all images in code to include their extension i.e. "background.png"

I still have the same problem where the images layer themselves apparently randomly, can anyone recommend a fix or some other possible solutions I may have missed?

Thank you.

As @tobias-lott mentioned in his comment I've had to bow include zPosition to every Sprite rather then letting the code order the sprites.