import SpriteKit public func bubble_0_action() { bubble_0.alpha = 1 var fades = SKAction.fadeAlpha(to: 1.0, duration: 1.0) blackOut.run(fades) DispatchQueue.main.asyncAfter(deadline: .now() + 2) { bubble_0.isHidden = true bubble_0_title.isHidden = true phone_side.isHidden = true addiction += 10.0 addictionChange() var deFade = SKAction.fadeAlpha(to: 0.0, duration: 1.0) blackOut.run(deFade) } } public func bubble_1_action() { bubble_1.alpha = 1 var fades = SKAction.fadeAlpha(to: 1.0, duration: 1.0) blackOut.run(fades) DispatchQueue.main.asyncAfter(deadline: .now() + 2) { bubble_0.isHidden = true bubble_0_title.isHidden = true bubble_1.isHidden = true bubble_1_title.isHidden = true phone_side.isHidden = true addiction -= 2 char_clothes = "char_working_" let changeClothes = SKTexture(imageNamed: char_clothes + "left.png") player.texture = changeClothes addictionChange() bubble_2.isHidden = false bubble_2_title.isHidden = false var deFade = SKAction.fadeAlpha(to: 0.0, duration: 1.0) blackOut.run(deFade) } } public func bubble_0_1_action() { bubble_0_1.alpha = 1 var fades = SKAction.fadeAlpha(to: 1.0, duration: 1.0) blackOut.run(fades) DispatchQueue.main.asyncAfter(deadline: .now() + 2) { player.isHidden = true bubble_0_1.isHidden = true bubble_0_1_title.isHidden = true chair.size = CGSize(width: 141, height: 247) chair.position = CGPoint(x: 400, y: 246.5) let chairWorkin = SKTexture(imageNamed: "workin.png") chair.texture = chairWorkin var deFade = SKAction.fadeAlpha(to: 0.0, duration: 1.0) blackOut.run(deFade) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { phone.isHidden = false } playSound(sound: notification) } } public func playSound(sound : SKAction){ runAction(sound: notification) }