Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { //выстрел с нашей стороны
- guard touches.first != nil else {
- return
- }
- let myShot = SKSpriteNode()
- let myShotAnimation = SKAction.repeatActionForever(SKAction.animateWithTextures(myShotTexture, timePerFrame: 0.01))
- myShot.size = CGSizeMake(200, 200)
- myShot.anchorPoint = CGPoint(x: 0.5, y: 0.5)
- myShot.zPosition = 0
- sprite!.addChild(myShot)
- let myShotAction = SKAction.group([SKAction.scaleBy(0.1, duration: 0.5), myShotAnimation])
- let actionRemove = SKAction.removeFromParent()
- myShot.runAction (SKAction.sequence([myShotAction, actionRemove]))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement