Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let bullet = SKSpriteNode(fileNamed: "Bullet")
- bullet?.size = CGSize(width: 100, height: 100)
- bullet.zPosition = -5
- bullet.position = CGPointMake(player.position.x, player.position.y)
- bullet.zRotation = player.zRotation
- let action = SKAction.moveToY(self.size.height + 30, duration: 0.8)
- let actionDone = SKAction.removeFromParent()
- bullet.runAction(SKAction.sequence([action, actionDone]))
- bullet.physicsBody = SKPhysicsBody(rectangleOfSize: bullet.size)
- bullet.physicsBody?.affectedByGravity = false
- bullet.physicsBody?.dynamic = false
- self.addChild(bullet)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement