ios – Adding lives to a game made with fast

I would like to add lives to an exercise game that I do. The declaration and code would be:

We need to add to the game the characteristic of the lives in the game. We will make sure that our character has 3 lives in each game. If we collide, we will start again, but we will deduce a life from the character. So, up to 3 and once we finish our life, the GameOver message will appear. As long as we have lives, the score will increase so that if we collide a first time, we will continue with the same points we had before and so on in each life until the 3 are exhausted .

The code would be as follows:

import SpriteKit
import GameplayKit

class GameScene: SKScene, SKPhysicsContactDelegate {

    enum Colisiones: UInt32 {

    case Pajaro = 1
    case Objeto = 2
    case Brecha = 4


    var gameOver = false

    var pajaro = SKSpriteNode()
    var fondo = SKSpriteNode()
    var tubo1 = SKSpriteNode()
    var tubo2 = SKSpriteNode()
    var puntuacionLabel = SKLabelNode()
    var puntuacion = 0
    var gameOverLabel = SKLabelNode()
    var timer = Timer()
    var play = false

    @objc func  crearTubos(){

        //Añadir Tubos
        let brechaAltura = pajaro.size.height * 4

        //Añadir random a los tubos
        let movimiento = arc4random() % UInt32(self.frame.height / 2)
        let tuboFuera = CGFloat(movimiento) -
        self.frame.height / 4

        //Añadir movimientos a los tubos
        let  moverTubos = SKAction.moveBy(x: -2 * self.frame.width, y: 0, duration: TimeInterval(self.frame.width/100))

        //Añadir Tubo1
        let tubo1Textura = SKTexture(imageNamed: "tubo2.png")
        tubo1 = SKSpriteNode(texture: tubo1Textura)
        tubo1.position = CGPoint(x: self.frame.midX + self.frame.width, y: self.frame.midY + tubo1Textura.size().height/2 + brechaAltura/2 + tuboFuera)
        tubo1.physicsBody = SKPhysicsBody(rectangleOf: tubo1.size)
        tubo1.physicsBody?.isDynamic = false
        tubo1.physicsBody?.collisionBitMask = Colisiones.Objeto.rawValue
        tubo1.physicsBody?.contactTestBitMask = Colisiones.Objeto.rawValue
        tubo1.physicsBody?.categoryBitMask = Colisiones.Objeto.rawValue
        tubo1.zPosition = -1


        //Añadir Tubo2
        let tubo2Textura = SKTexture(imageNamed: "tubo1.png")
        tubo2 = SKSpriteNode(texture: tubo2Textura)
        tubo2.position = CGPoint(x: self.frame.midX + self.frame.width, y: self.frame.midY -
        tubo1Textura.size().height / 2 - brechaAltura / 2 + tuboFuera)
        tubo2.physicsBody = SKPhysicsBody(rectangleOf: tubo2.size)
        tubo2.physicsBody?.isDynamic = false
        tubo2.physicsBody?.collisionBitMask = Colisiones.Objeto.rawValue
        tubo2.physicsBody?.contactTestBitMask = Colisiones.Objeto.rawValue
        tubo2.physicsBody?.categoryBitMask = Colisiones.Objeto.rawValue
        tubo2.zPosition = -1


        //Crear brecha

        let brecha = SKNode()
        brecha.position = CGPoint(x: self.frame.midX + self.frame.width, y: self.frame.midY + tuboFuera)
        brecha.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: tubo1Textura.size().width, height: brechaAltura))
        brecha.physicsBody!.isDynamic = false
        brecha.physicsBody?.collisionBitMask = Colisiones.Brecha.rawValue
        brecha.physicsBody?.contactTestBitMask = Colisiones.Pajaro.rawValue
        brecha.physicsBody?.categoryBitMask = Colisiones.Brecha.rawValue



    override func didMove(to view: SKView) {

        self.physicsWorld.contactDelegate = self



    func setupGame() {

        // Añadir fondo
        let fondoTextura = SKTexture(imageNamed: "fondo")

        let animacion1 = SKAction.moveBy(x: -fondoTextura.size().width, y: 0, duration:7)
        let animacion2 = SKAction.moveBy(x: fondoTextura.size().width, y: 0, duration: 0)
        let movimientoFondo = SKAction.repeatForever(SKAction.sequence((animacion1, animacion2)))

        var i: CGFloat = 0

        while i < 3 {

            fondo  = SKSpriteNode(texture: fondoTextura)
            fondo.position = CGPoint(x: fondoTextura.size().width *
            i, y: self.frame.midY)
            fondo.size.height = self.frame.height
            fondo.zPosition = -2
            i += 1


        // Añadir pajaro
        let pajaroTextura1 = SKTexture(imageNamed: "pajaro1")
        let pajaroTextura2 = SKTexture(imageNamed: "pajaro2")
        let animacionPajaro = SKAction.animate(with: (pajaroTextura1,
            pajaroTextura2), timePerFrame: 0.1)
        let movimientoPajaro = SKAction.repeatForever(animacionPajaro)

        pajaro = SKSpriteNode(texture: pajaroTextura1)
        pajaro.position = CGPoint(x: self.frame.midX, y: self.frame.midY)
        pajaro.physicsBody = SKPhysicsBody(circleOfRadius:
        pajaro.physicsBody!.isDynamic = false

        //Categorias con las que va a chocar
        pajaro.physicsBody!.collisionBitMask = Colisiones.Pajaro.rawValue
        pajaro.physicsBody!.contactTestBitMask = Colisiones.Objeto.rawValue
        pajaro.physicsBody!.categoryBitMask = Colisiones.Pajaro.rawValue


        //Crear suelo
        let suelo = SKNode()
        suelo.position = CGPoint(x: self.frame.midX, y: -self.frame.height/2)
        suelo.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: self.frame.width, height: 1))
        suelo.physicsBody?.isDynamic = false
        suelo.physicsBody?.collisionBitMask = Colisiones.Objeto.rawValue
        suelo.physicsBody?.contactTestBitMask = Colisiones.Objeto.rawValue
        suelo.physicsBody?.categoryBitMask = Colisiones.Objeto.rawValue


        //Añadir puntuacion Label
        puntuacionLabel.fontName = "Helvetica"
        puntuacionLabel.fontSize = 40
        puntuacionLabel.text = "0"
        puntuacionLabel.position = CGPoint(x: self.frame.midX, y: self.frame.height / 2 - 110)

        //Contador de vidas


    func didBegin(_ contact: SKPhysicsContact) {

        if !gameOver{

            if contact.bodyA.categoryBitMask == Colisiones.Brecha.rawValue || contact.bodyB.categoryBitMask == Colisiones.Brecha.rawValue {

                puntuacion += 1
                puntuacionLabel.text = String(puntuacion)


                // Añadir game Over label

                gameOverLabel.fontName = "Helvetica"
                gameOverLabel.fontSize = 40
                gameOverLabel.text = "Game Over! Pulsa para comenzar"
                gameOverLabel.position = CGPoint(x: self.frame.midX, y: self.frame.midY)
                self.speed = 0
                gameOver = true
                play = false


    override func touchesBegan(_ touches: Set, with event: UIEvent?) {

        if !gameOver{

            if !play{

            //Añadir repeticion de los tubos

                timer = Timer.scheduledTimer(timeInterval: 3, target: self, selector:
                    #selector(GameScene.crearTubos), userInfo:nil, repeats: true)
                play = true


            pajaro.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
            pajaro.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 70))
            pajaro.physicsBody?.isDynamic = true

        } else {
            puntuacion = 0
            self.speed = 1
            gameOver = false



    override func update(_ currentTime: TimeInterval) {



Is Black Lives Matter a good or bad move?

Overall bad, but not as bad as some.

First of all, it suggests that there is a bias against blacks when it comes to shootings by the police, while the police shoot more whites than they do. Black. Second, assert that a black life matters, insinuates that other lives matter less.

BLM seeks to increase racial tension and divide people rather than promote non-discrimination and harmony among people.

[ Politics ] Open question: Obama buys a 15 million euro home on Martha's vineyard. Nancy Peliosi lives well while homeless people are on her streets. What happened to.?

How much do you need or how much money do you need?

Need help to know where a code lives

I have struggled with this problem for a few days and I do not understand it. Basically, I'm editing a WordPress site and I'm using the Inspector (Firefox or Chrome). I was able to play with the code of the inspector, and then edit the corresponding files on the server to make the changes permanent several times. However, there is this code with which I have difficulties, because I can not Determine in which file it really is. I can see that in some cases the inspector indicates in which file is a code (even the line), as we can see on the screenshot, but this code does not show the name. of the file (that is, style.css), instead, it only shows "inline …". If I click here, it leads me to another section with more details, but the problem remains fundamentally the same; I still do not know what file this code is in.

I have tried to open multiple files and search the code, but I can not find it. This is definitely not in the style.css, nor the index.php, header.php or footer.php

Here is a screenshot:

Thank you. Any idea of ​​how to do it is very much appreciated.

dating site ladylike casually dating and pregnant 0726

Reviewed by Backpack sure
dating site ladylike casually dating and pregnant 0726
dating website heightonline dating for amputeescosta rica hook online dating site listbest dating app maniladating reality shows on huludantes apps at budapestmatchmaking meaning in gujaratidating Survival Guide7 dating site is shakira dating nicky jamwhat is the best dating app in dubaihookup at san angelo sites dating site sarniadating to
Evaluation: 5


[ Politics ] Open question: Why do Republicans care more about the fetus than the lives of schoolchildren?

[ Politics ] Open question: Why do Republicans care more about the fetus than the lives of schoolchildren? .

Why do people who have never voted for a Republican of their lives now turn to Trump?

I saw a show that interviewed residents of the districts that were supposed to vote for Hillary, but instead voted for Trump. The overwhelming feeling was something like:

"I do not really like Trump, actually I think he's pretty heinous, but at least he recognizes the issues that concern me and will address those issues for which Clinton simply claims that they do not are not problematic ".


5th dnd – Can an intellectual devourer use Devour Intellect when he lives in the body of a creature?

In the MM (p.191), it is said that a devouring intellect, while using its Body Thief action:

keeps his scores of intelligence, wisdom and charisma, as well as his understanding of deep speech, his telepathy and his traits. It also adopts target statistics.

is Devour the intellect, an action that the devouring intellect has, considered a trait?

It seems to me that traits range from scores of his abilities to monster statistics block actions, so he could not use Devour the intellect by controlling the body of another.

Does anyone have a glimpse of that?

[ Rodents ] Open question: Should the US just invade Central America, eliminate gangs and cartels and make people's lives safer?

[ Rodents ] Open question: Should the US just invade Central America, eliminate gangs and cartels and make people's lives safer? .

MSNBot Lives!

It looks like it may be time to change the description of this forum by replacing "THE search engine". to "THE defending champion (for the moment)"

It has been reported that MSNBot has been deep exploring some large sites more actively than Googlebot in recent days.

Looks like MSN may be going back a switch soon.