如何让xcode在GameScene.swift中运行代码而不是GameScene.sks?
答案 0 :(得分:4)
一切都在$('p strong').each(function(i, element){
var $this = $(this);
var headline = $this.text(); // Get headline text
var parent = $this.parent(); // Get parent
$this.remove(); // Remove headline element
var body = parent.text(); // Get body text
// ...
});
GameViewController
您可以通过替换此代码来更改它
if let view = self.view as! SKView? {
// Load the SKScene from 'GameScene.sks'
if let scene = SKScene(fileNamed: "GameScene") {
// Set the scale mode to scale to fit the window
scene.scaleMode = .aspectFill
// Present the scene
view.presentScene(scene)
}
view.ignoresSiblingOrder = true
view.showsFPS = true
view.showsNodeCount = true
}
它将运行if let view = self.view as! SKView? {
let scene = GameScene(size: view.bounds.size)
// Set the scale mode to scale to fit the window
scene.scaleMode = .aspectFill
// Present the scene
view.presentScene(scene)
view.ignoresSiblingOrder = true
view.showsFPS = true
view.showsNodeCount = true
}
中的代码而不是GameScene.swift
中的代码。所以你可以按代码创建节点。