IPhone : avoid resizing when new texture is set

on Monday, March 30, 2015

I am adding the spritenode to the scene, the size is given.


But when I change the texture of the spritenode, the size automatically changes to the original size of the image(png) of the texture.


How can I avoid this?


My code:



var bomba = SKSpriteNode(imageNamed: "bomba2")
var actionbomba = SKAction()
bomba.size = CGSizeMake(frame2.size.width/18, frame2.size.width/18)
let bomba3 = SKTexture(imageNamed: "bomba3.png")
actionbomba.addObject(SKAction.moveBy(CGVectorMake(0, frame.size.height/2.65), duration: 1))
actionbomba.addObject(SKAction.setTexture(bomba3,resize: false))

addChild(bomba)
bomba.runAction(SKAction.repeatAction(SKAction.sequence(actionbomba), count: -1))

0 comments:

Post a Comment