由于动画精灵,iDevice崩溃了

时间:2015-05-18 15:08:57

标签: ios xcode swift animation sprite

当我的英雄击中它时,我试图让我的一个精灵有一个动画,我的应用程序在我的iDevice上崩溃,xCode似乎把它归咎于我制作的动画SKAction。

这是我的代码:

var fire: SKSpriteNode! = SKSpriteNode(imageNamed:"1")//I've set this as a universal variable

var anime = SKAction.animateWithTextures([SKTexture(imageNamed: "1"), // apparently this line causes the crash
        SKTexture(imageNamed:"2"),
        SKTexture(imageNamed:"3"),
        SKTexture(imageNamed:"4"),
        SKTexture(imageNamed:"5"),
        SKTexture(imageNamed:"6"),//this line is also a problem apparently
        SKTexture(imageNamed:"7")], timePerFrame: 0.1)
    fire.runAction(SKAction.repeatActionForever(anime))
    fire.size = CGSize(width: targetSprite.size.width*1.3, height: self.frame.size.height*0.9)
    fire.position = targetSprite.position
    fire.runAction(SKAction.sequence([fall,kill]))
    addChild(fire)
return fire

崩溃之后xCode指向我指出的两条线之一,并说EXC_BAD_ACCESS代码= 1并且它没有崩溃消息。

0 个答案:

没有答案