Advertisement
Guest User

Untitled

a guest
May 29th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { //выстрел с нашей стороны
  2. guard touches.first != nil else {
  3. return
  4. }
  5.  
  6. let myShot = SKSpriteNode()
  7. let myShotAnimation = SKAction.repeatActionForever(SKAction.animateWithTextures(myShotTexture, timePerFrame: 0.01))
  8. myShot.size = CGSizeMake(200, 200)
  9. myShot.anchorPoint = CGPoint(x: 0.5, y: 0.5)
  10. myShot.zPosition = 0
  11. sprite!.addChild(myShot)
  12. let myShotAction = SKAction.group([SKAction.scaleBy(0.1, duration: 0.5), myShotAnimation])
  13. let actionRemove = SKAction.removeFromParent()
  14. myShot.runAction (SKAction.sequence([myShotAction, actionRemove]))
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement