表达式类型(imageNamed:String)没有更多上下文是不明确的

时间:2018-03-24 05:51:26

标签: ios swift sprite-kit

你能帮帮我吗?可能是什么问题? 这是完整的代码!

import SpriteKit

class GameScene: SKScene {

var bird = SKSpriteNode()

override func didMove(to view: SKView) {
    /* Setup your scene here */

    //Physics
    self.physicsWorld.gravity=CGVector(dx: 0.0, dy: -5.0);

    //Bird
    let BirdTextures = (imageNamed:  "bird") //Expression Type(imageNamed: String) is ambiguous without more context.
    BirdTextures.filteringMode = SKTextureFilteringMode.Nearest

    bird = SKSpriteNode(texture : BirdTextures)
    bird.setScale(0.5)
    bird.position = CGPoint(x: self.frame.size.width * 0.35, y: self.frame.size.height * 0.6)

1 个答案:

答案 0 :(得分:0)

let BirdTextures = SKTexture(imageNamed: "bird")

Change it to something more meaningful