Swift 2 SpriteKit问题 [英] Swift 2 SpriteKit issues

查看:95
本文介绍了Swift 2 SpriteKit问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以自升级到iOS 9以来,甚至升级到Swift 2之后,我的spriteKit游戏都遇到了一些问题.我在这里提到1

So I am having some issues with my spriteKit game since upgrading to iOS 9 and even after upgrading to Swift 2. I mentioned 1 here Atlas images wrong size on iPad iOS 9

但是我还有2个无法解决的问题.

However I am having 2 more issues I cannot fix.

1)

我所有的粒子效果都不再起作用.这是我使用的代码,它们不再显示了.如果我只是使用SKEmitterNode而不是它的工作原理,但我更喜欢将SKEmitterNode添加到SKEffectNode,因为它与背景等的融合效果更好. 这是代码.

All my particle effects dont work anymore. This is the code I use and they are just not showing up anymore. If I just use SKEmitterNode than it works, but I prefer to add the SKEmitterNode to a SKEffectNode as it blends much better with backgrounds etc. This is the code.

let particlesPath = NSBundle.mainBundle().pathForResource("Thrusters", ofType: "sks")!
let particles = NSKeyedUnarchiver.unarchiveObjectWithFile(particlesPath) as! SKEmitterNode
let particleEffects = SKEffectNode() //blends better with background when moving

particleEffects.zPosition = 20
particleEffects.position = CGPointMake(0, -50)
particleEffects.addChild(particles)

addChild(particleEffects)

我读了这个 http://forum. iphonedev.tv/t/10-8-skeffectnode-or-xcode-7-or-my-issue/669 它声称它是固定的,但不是.

I read this http://forum.iphonedev.tv/t/10-8-skeffectnode-or-xcode-7-or-my-issue/669 and it claims it was fixed, but it wasn't.

2)

即使我的游戏是横向游戏,登录或成就弹出时我的Game Center横幅现在都使用纵向横幅.因此,横幅仅覆盖顶部屏幕的一半.看起来太糟糕了,因为实际上没有横幅代码,我什至不知道从哪里开始.

My Game Center banners when I log in or when an achievement pops are now using the portrait banner, even though my game is in landscape. Therefore banners only cover half the top screen. It looks so bad and since there is no actually code for banners I dont even know where to start.

其他任何人都面临着这些问题,令人沮丧. 感谢您的帮助或支持.

Anyone else facing these issues, its frustrating. Thanks for any help or support.

推荐答案

对此旧问题进行了一些更新.不管您是否相信粒子,苹果最近都回复了我一岁的BugReport,以查看它是否已在iOS 10中修复.LOL

Some updates to this old question. Believe it or not in regards to the particles, apple recently replied to my 1 year old BugReport to see if it is fixed in iOS 10. LOL

我听说通过SKEffectNode方式渲染粒子在性能方面不一定是理想的,并且我不再使用它.因此,我不确定在以后的Xcode和iOS 9更新中还是在iOS 10 beta中是否仍在发生该错误.

I heard rendering particles via a SKEffectNode way is not necessarily ideal in regards to performance and I am not using it anymore. Therefore I am not sure if the bug is still occurring with the later Xcode and iOS 9 updates or in iOS 10 beta.

关于adMob横幅,我只需要更改

In regards to the adMob banner, I simply had to change

let adMobBannerAdView = GADBannerView()

var adMobBannerAdView: GADBannerView?

,并延迟初始化,直到ViewDidLoad/DidMoveToView.

and delay initialisation until ViewDidLoad/DidMoveToView.

这篇关于Swift 2 SpriteKit问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆