我有一个新的游戏我刚开始使用swift在sprite工具包中构建,我想知道如何在多个场景中无缝地使用SKEmitterNode。目前我的游戏包括3个场景:菜单,游戏和游戏结束。我想在所有3个场景中使用背景中的SKEmitterNode,没有任何停顿。非常感谢任何帮助,谢谢!
答案 0 :(得分:2)
感谢KnightOfDragon和Whirlwind帮助评论,只需将发射器传递到下一个场景就可以正常工作,而不会中断粒子。
我在'介绍中设置了Dim dest As String = Label1.Text
' Before we do anything at all, make sure dest is actually a path
If Not Directory.Exists(dest) Then
Throw New DirectoryNotFoundException("dest is not valid.")
End If
' Set up a temporary list of items to remove, no larger than the original list
Dim toRemove As New List(Of String)(myfiles.Count)
' Loop over myfiles and add to the delete queue anything that actually exists
For Each myfile in myfiles
If File.Exists(Path.Combine(dest, myfile)) Then
toRemove.Add(myFile)
End If
Next
' If there's anything in the removal queue, try to remove it from the original list
For Each removal in toRemove
myfiles.Remove(removal)
Next
。场景并在全球宣布。
然后在移动到下一个之前的当前场景中:
SKEmitterNode
并在新场景中:
emitter.removeFromParent()