{"id":105,"date":"2020-10-19T13:30:46","date_gmt":"2020-10-19T11:30:46","guid":{"rendered":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/?page_id=105"},"modified":"2024-05-08T09:01:20","modified_gmt":"2024-05-08T08:01:20","slug":"juega-con-tus-heroes","status":"publish","type":"page","link":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/","title":{"rendered":"Juega con tus h\u00e9roes"},"content":{"rendered":"<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"background-color: rgba(255,255,255,0);background-position: center center;background-repeat: no-repeat;border-width: 0px 0px 0px 0px;border-color:#e2e2e2;border-style:solid;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start\" style=\"max-width:104%;margin-left: calc(-4% \/ 2 );margin-right: calc(-4% \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-flex-column\"><div class=\"fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\"><script src=\"\/\/cdn.jsdelivr.net\/npm\/phaser@3.23.0\/dist\/phaser.js\"><\/script>\n<script type=\"text\/javascript\">\n\nconst DEFAULT_WIDTH = 1080;\nconst DEFAULT_HEIGHT = 1920;\nconst MAX_WIDTH = 1620;\nconst MAX_HEIGHT = 2880;\nlet SCALE_MODE = 'SMOOTH'; \/\/ FIT OR SMOOTH\n \nvar deltaMouseX = 0;\nvar deltaMouseY = 0;\nvar mouseXAnt = 0;\nvar mouseYAnt = 0;\nvar deteccMvto = false;\n\nconst PTOSBONIF = 10;\nconst PTOSELIMINAR = 5;\n    \nvar config = {\n    type: Phaser.AUTO,\n    width: DEFAULT_WIDTH,\n    height: DEFAULT_HEIGHT,\n    physics: {\n        default: 'arcade',\n        arcade: {\n            gravity: { y: 100 },\n            debug: false\n        }\n    },\n    scale: {\n        mode: Phaser.Scale.FIT,\n        \/\/mode: Phaser.Scale.WIDTH_CONTROLS_WIDTH  ,\n        \/\/mode: Phaser.Scale.WIDTH_CONTROLS_WIDTH,\n        \/\/mode : Phaser.Scale.NONE,\n        autoCenter: Phaser.Scale.CENTER_BOTH   ,\/\/CENTER_HORIZONTALLY CENTER_BOTH\n        parent: 'phaser-example',\n        width: DEFAULT_WIDTH,\n        height: DEFAULT_HEIGHT,\n        zoom: 1\n    },\n    \/*scene: {\n        preload: preload,\n        create: create,\n        update: update\n    }*\/\n};\n    \nvar titleScene = new Phaser.Scene(\"title\");\nvar instruccionesScene = new Phaser.Scene(\"instrucciones\");\nvar pantallaFin1Scene = new Phaser.Scene(\"pantallaFin1\");\nvar pantallaFin2Scene = new Phaser.Scene(\"pantallaFin2\");\nvar pantallaFin3Scene = new Phaser.Scene(\"pantallaFin3\");\nvar gameScene = new Phaser.Scene(\"game\");\n\n    var game = new Phaser.Game(config);\n\/\/ Add both scenes (it does not start them)\ngame.scene.add('title', titleScene);\ngame.scene.add(\"game\", gameScene);  \ngame.scene.add(\"instrucciones\", instruccionesScene);  \ngame.scene.add(\"pantallaFin1\", pantallaFin1Scene); \ngame.scene.add(\"pantallaFin2\", pantallaFin2Scene); \ngame.scene.add(\"pantallaFin3\", pantallaFin3Scene);  \n    \n\/\/ Start the title scene\ngame.scene.start('title');\n\nvar timedEvent;\nvar contTextoPtos;\nvar timerCount = 0;\nvar maxTime = 60;\nvar ptosPantalla1 = 50;\nvar ptosPantalla2 = 120;\n\nvar velMvtoTecla = 10;\n    \nvar player;\nvar playerReal;\nvar fondo;\nvar fondoPuntos;\nvar fondoTiempo;\n    \nvar manoOK;\nvar manoMAL;\n    \nvar stars;\nvar alimentosSaludablesGO;\nvar alimentosNoSaludablesGO;\nvar platforms;\nvar cursors;\nvar score = 0;\nvar gameOver = false;\nvar scoreText;\nvar timerText;\nvar pointText;\nvar inputMouse;\nvar worldBounds;\nvar offsetYPlayer;\n    \nvar playerSelecc = false;\n    \nvar miPuntuacion = 0;\n    \nvar orientation; \nvar enLandscape = false;\n    \n    var tamXCanvas;\n    var tamYCanvas;\n    \n    var newWidth;\n    var newHeight;\n    var smooth = 1;\n    var scale;\n    var w,h;\n    \n    var audioAcierto;\n    var audioFallo;\n    var audiosCargados = false;\n    \nvar alimentosSaludables= [\"aguacate.png\",\n                        \"fresa.png\",\n                        \"habas.png\",\n                        \"kiwi.png\",\n                        \"lechuga.png\",\n                        \"naranja.png\",\n                        \"patata.png\",\n                        \"pepino.png\",\n                        \"pera.png\",\n                        \"platano.png\",\n                        \"sandia.png\",\n                        \"zanahoria.png\"\n                       ];\nvar alimentosNoSaludables= [\"batido.png\",\n                        \"caramelo.png\",\n                        \"chocolate.png\",\n                        \"cookie.png\",\n                        \"croissant.png\",\n                        \"cucurucho.png\",\n                        \"donuts.png\",\n                        \"hamburguesa.png\",\n                        \"helado.png\",\n                        \"Hot_dogs.png\",\n                        \"patatas.png\",\n                        \"pizza.png\",\n                       ];\n    \n    \n\/\/VARS PANTALLA TITULO\nvar fondoTit;\nvar btnJugarTit;\nvar btnInsTit;\n    \n\/\/VARS PANTALLA INST\nvar fondoIns;\nvar btnJugarIns;\n    \n\/\/VARS PANTALLA FIN 1\nvar fondoFin1;\nvar btnSalirFin1;\nvar btnJugarFin1;\n    \n\/\/VARS PANTALLA FIN 2\nvar fondoFin2;\nvar btnSalirFin2;\nvar btnJugarFin2;\n    \n\/\/VARS PANTALLA FIN 3\nvar fondoFin3;\nvar btnSalirFin3;\nvar btnJugarFin3;\n    \nvar miContextoGlobal;\n    \nvar audioFondo;\nvar img5ptos;\nvar img10ptos;\n    \nvar enAnimAcierto = false;\nvar enAnimFallo = false;\nvar subiendoAcierto = true;\/\/empieza subiendo\nvar subiendoFallo = true;\/\/empieza subiendo\n    \nvar posYIniManosAciertoFallo = 468;\nvar timeDelayedCallMostrarAciertoFall0 = 700;\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/PANTALLA TITULO\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ntitleScene.preload = function()\n{\n    \n    Precarga(this);\n    \n    \/\/assets tit\n    this.load.image('fondoTit', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/Juego_Frutas_PantallaInicio.jpg');\n    this.load.image('btnJugar', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_jugar.png');\n    this.load.image('btnIns', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_instrucciones.png');\n    \n    \/\/assets instrucciones\n    this.load.image('fondoIns', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/Juego_Frutas_PantallaInstrucciones.jpg');\n    this.load.image('btnJugarIns', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_jugar.png');\n    \n    \/\/assets fin 1\n    this.load.image('fondoFin1', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/Juego_Frutas_PantallaFin1.jpg');\n    this.load.image('btnJugarFin1', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_jugar.png');\n    this.load.image('btnSalirFin1', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_salir.png');\n    \n    \/\/assets fin 2\n    this.load.image('fondoFin2', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/Juego_Frutas_PantallaFin2.jpg');\n    this.load.image('btnJugarFin2', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_jugar.png');\n    this.load.image('btnSalirFin2', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_salir.png');\n    \n    \/\/assets fin 3\n    this.load.image('fondoFin3', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/Juego_Frutas_PantallaFin3.jpg');\n    this.load.image('btnJugarFin3', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_jugar.png');\n    this.load.image('btnSalirFin3', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/boton_salir.png');\n    \n    \/\/assets juego\n    this.load.image('fondo', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/Fondo_Cocina_solo.jpg');\n    this.load.image('plato', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/plato.png');\n    this.load.image('platoRedu', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/platoRedu.png');\n    this.load.image('fondoPuntos', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/PUNTOSESC.png');\n    this.load.image('fondoTiempo', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/tiempoESC.png');\n    this.load.image('5ptos', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/5ptos2.png');\n    this.load.image('10ptos', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/10ptos2.png');\n    \n    this.load.image('manoOK', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/acierto2.png');\n    this.load.image('manoMAL', '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/fallo2.png');\n    \n    this.load.audio('fondo', [\n        '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/audios\/fondo.mp3'\n    ], {\n        instances: 1\n    });\n    \n    for (i = 0; i < alimentosSaludables.length; i++) \n    {\n        this.load.image('alimentoSaludable' + i, '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/PERSONAJES\/' + alimentosSaludables[i]);\/\/76 x 76\n    }\n    for (i = 0; i < alimentosNoSaludables.length; i++) \n    {\n        this.load.image('alimentoNoSaludable' + i, '\/pon-mas-heroes-en-tu-plato\/wp-content\/assets\/PERSONAJES\/' + alimentosNoSaludables[i]);\/\/76 x 76\n    }\n    \n    \/\/this.load.image('star', 'assets\/star.png');\/\/380 x 130\n    \/\/this.load.image('bomb', 'assets\/bomb.png');\/\/380 x 130\n    \/\/this.load.spritesheet('dude', 'assets\/dude.png', { frameWidth: 32, frameHeight: 48 });\n}  \nfunction Precarga(contexto)\n{\n    var width = contexto.cameras.main.width;\n            var height = contexto.cameras.main.height;\n    \n      var progressBar = contexto.add.graphics();\n            var progressBox = contexto.add.graphics();\n            progressBox.fillStyle(0x222222, 0.8);\n            progressBox.fillRect(width \/ 2 - 160, height \/ 2 - 30, 320, 50);\n            \n            \n            var loadingText = contexto.make.text({\n                x: width \/ 2,\n                y: height \/ 2 - 100,\n                text: 'Cargando...',\n                style: {\n                    font: '50px monospace',\n                    fill: '#ffffff'\n                }\n            });\n            loadingText.setOrigin(0.5, 0.5);\n            \n            var percentText = contexto.make.text({\n                x: width \/ 2,\n                y: height \/ 2 - 5,\n                text: '0%',\n                style: {\n                    font: '38px monospace',\n                    fill: '#ffffff'\n                }\n            });\n            percentText.setOrigin(0.5, 0.5);\n            \n            var assetText = contexto.make.text({\n                x: width \/ 2,\n                y: height \/ 2 + 50,\n                text: '',\n                style: {\n                    font: '48px monospace',\n                    fill: '#ffffff'\n                }\n            });\n \n            assetText.setOrigin(0.5, 0.5);\n            \n            contexto.load.on('progress', function (value) {\n                percentText.setText(parseInt(value * 100) + '%');\n                progressBar.clear();\n                progressBar.fillStyle(0xffffff, 1);\n                progressBar.fillRect(width \/ 2 - 150, height \/ 2 - 20, 300 * value, 30);\n            });\n            \n            contexto.load.on('fileprogress', function (file) {\n                \/\/assetText.setText('Loading asset: ' + file.key);\n            });\n \n            contexto.load.on('complete', function () {\n                progressBar.destroy();\n                progressBox.destroy();\n                loadingText.destroy();\n                percentText.destroy();\n                assetText.destroy();\n            });  \n}\n\ntitleScene.create = function()\n{\n    \/\/for mouse position\n    inputMouse = this.input;\n    \n    \/\/FONDO \n    fondoTit = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT \/ 2, 'fondoTit');\n    \n    \/\/BTN JUGAR\n    \/\/btnJugarTit = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 265, 'btnJugar');\n    btnJugarTit = this.add.image(DEFAULT_WIDTH \/ 2 - 250, DEFAULT_HEIGHT - 265, 'btnJugar');\n    btnJugarTit.setInteractive({ });\/\/necesario para que reciba eventos\n    \/\/btnJugarTit.on('pointerdown', () => { OnPointerdownBtnJugarTit (this); });\n    btnJugarTit.on('pointerover', () => { OnPointeroverBtnJugarTit (this); });\n    \n    btnJugarTit.on('pointerup', function () {\n            this.scene.switch('game');\n            if(!audioFondo.isPlaying)audioFondo.play();\n            if (this.scale.isFullscreen)\n            {\n                this.scale.stopFullscreen();\n            }\n            else\n            {\n                this.scale.startFullscreen();\n            } \n        }, this);\n    \n    \n    \/\/BTN INSTRUCCIONES\n    \/\/btnInsTit = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 100, 'btnIns');\n    btnInsTit = this.add.image(DEFAULT_WIDTH \/ 2 + 250, DEFAULT_HEIGHT - 265, 'btnIns'); \n    btnInsTit.setInteractive({ });\/\/necesario para que reciba eventos\n    btnInsTit.on('pointerdown', () => { OnPointerdownBtnInsTit (this); });\n    btnInsTit.on('pointerover', () => { OnPointeroverBtnInsTit (this); });\n    audioFondo = this.sound.add('fondo', {volume: 0.3});\n    audioFondo.loop = true;\n}\n\nfunction OnPointerdownBtnJugarTit (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnJugarTit');\n    if(!audioFondo.isPlaying)audioFondo.play();\n    \/\/GoFullScreen(miContexto);\n    miContexto.scene.switch('game');\n}\nfunction OnPointeroverBtnJugarTit (miContexto)\n{\n    \/\/console.log('OnPointerOverBtnJugarTit');\n}\n    \nfunction OnPointerdownBtnInsTit (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnInsTit');\n    miContexto.scene.switch('instrucciones');\n}\nfunction OnPointeroverBtnInsTit (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnInsTit');\n}\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/PANTALLA INSTRUCCIONES\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ninstruccionesScene.preload = function()\n{\n    \/\/this.load.image('fondoIns', 'assets\/Juego_Frutas_PantallaInstrucciones.jpg');\n    \/\/this.load.image('btnJugarIns', 'assets\/boton_jugar.png');\n}  \ninstruccionesScene.create = function()\n{\n    \/\/for mouse position\n    inputMouse = this.input;\n    \n    \/\/FONDO \n    fondoIns = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT \/ 2, 'fondoIns');\n    \n    \/\/BTN JUGAR\n    \/\/btnJugarIns = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 100, 'btnJugarIns');\n    btnJugarIns = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 265, 'btnJugarIns');\n    btnJugarIns.setInteractive({ });\/\/necesario para que reciba eventos\n    \/\/btnJugarIns.on('pointerdown', () => { OnPointerdownBtnJugarIns (this); });\n    btnJugarIns.on('pointerup', function () {\n            this.scene.switch('game');\n            if(!audioFondo.isPlaying)audioFondo.play();\n            if (this.scale.isFullscreen)\n            {\n                this.scale.stopFullscreen();\n            }\n            else\n            {\n                this.scale.startFullscreen();\n            } \n        }, this);\n    \n    btnJugarIns.on('pointerover', () => { OnPointeroverBtnJugarIns (this); });\n}\nfunction OnPointerdownBtnJugarIns (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnJugarIns');\n    if(!audioFondo.isPlaying)audioFondo.play();\n    \/\/GoFullScreen(miContexto);\n    miContexto.scene.switch('game');\n}\nfunction OnPointeroverBtnJugarIns (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnJugarIns');\n}\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/  \n    \n  \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/PANTALLA FIN 1\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\npantallaFin1Scene.preload = function()\n{\n    \/*this.load.image('fondoFin1', 'assets\/Juego_Frutas_PantallaFin1.jpg');\n    this.load.image('btnJugarFin1', 'assets\/boton_jugar.png');\n    this.load.image('btnSalirFin1', 'assets\/boton_salir.png');*\/\n}  \npantallaFin1Scene.create = function()\n{\n    \/\/for mouse position\n    inputMouse = this.input;\n    \n    \/\/FONDO \n    fondoFin1 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT \/ 2, 'fondoFin1');\n    \n    \/\/BTN JUGAR\n    \/\/btnJugarFin1 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 265, 'btnJugarFin1');\n    btnJugarFin1 = this.add.image(DEFAULT_WIDTH \/ 2 - 250, DEFAULT_HEIGHT - 265, 'btnJugarFin1');\n    btnJugarFin1.setInteractive({ });\/\/necesario para que reciba eventos\n    btnJugarFin1.on('pointerdown', () => { OnPointerdownBtnJugarFin1 (this); });\n    btnJugarFin1.on('pointerover', () => { OnPointeroverBtnJugarFin1 (this); });\n    \n    \/\/BTN INSTRUCCIONES\n    \/\/btnSalirFin1 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 100, 'btnSalirFin1');\n    btnSalirFin1 = this.add.image(DEFAULT_WIDTH \/ 2 + 250, DEFAULT_HEIGHT - 265, 'btnSalirFin1');\n    btnSalirFin1.setInteractive({ });\/\/necesario para que reciba eventos\n    \/\/btnSalirFin1.on('pointerdown', () => { OnPointerdownBtnSalirFin1 (this); });\n    btnSalirFin1.on('pointerup', function () {\n            this.scene.switch('title');\n            if(audioFondo.isPlaying)audioFondo.pause();\n            if (this.scale.isFullscreen)\n            {\n                this.scale.stopFullscreen();\n            }\n            else\n            {\n                this.scale.startFullscreen();\n            } \n        }, this);\n    btnSalirFin1.on('pointerover', () => { OnPointeroverBtnSalirFin1 (this); });\n}\nfunction OnPointerdownBtnJugarFin1 (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnJugarFin1');\n    miContexto.scene.switch('game');\n}\nfunction OnPointeroverBtnJugarFin1 (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnJugarFin1');\n}\n    \nfunction OnPointerdownBtnSalirFin1 (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnSalirFin1');\n    if(audioFondo.isPlaying)audioFondo.pause();\n    \/\/GoFullScreen(miContexto);\n    miContexto.scene.switch('title');\n}\nfunction OnPointeroverBtnSalirFin1 (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnSalirFin1');\n}\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/PANTALLA FIN 2\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\npantallaFin2Scene.preload = function()\n{\n    \/*this.load.image('fondoFin2', 'assets\/Juego_Frutas_PantallaFin2.jpg');\n    this.load.image('btnJugarFin2', 'assets\/boton_jugar.png');\n    this.load.image('btnSalirFin2', 'assets\/boton_salir.png');*\/\n}  \npantallaFin2Scene.create = function()\n{\n    \/\/for mouse position\n    inputMouse = this.input;\n    \n    \/\/FONDO \n    fondoFin2 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT \/ 2, 'fondoFin2');\n    \n    \/\/BTN JUGAR\n    \/\/btnJugarFin2 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 265, 'btnJugarFin2');\n    btnJugarFin2 = this.add.image(DEFAULT_WIDTH \/ 2 - 250, DEFAULT_HEIGHT - 265, 'btnJugarFin2');\n    btnJugarFin2.setInteractive({ });\/\/necesario para que reciba eventos\n    btnJugarFin2.on('pointerdown', () => { OnPointerdownBtnJugarFin2 (this); });\n    btnJugarFin2.on('pointerover', () => { OnPointeroverBtnJugarFin2 (this); });\n    \n    \/\/BTN INSTRUCCIONES\n    \/\/btnSalirFin2 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 100, 'btnSalirFin2');\n    btnSalirFin2 = this.add.image(DEFAULT_WIDTH \/ 2 + 250, DEFAULT_HEIGHT - 265, 'btnSalirFin2');\n    btnSalirFin2.setInteractive({ });\/\/necesario para que reciba eventos\n    \/\/btnSalirFin2.on('pointerdown', () => { OnPointerdownBtnSalirFin2 (this); });\n    btnSalirFin2.on('pointerup', function () {\n            this.scene.switch('title');\n            if(audioFondo.isPlaying)audioFondo.pause();\n            if (this.scale.isFullscreen)\n            {\n                this.scale.stopFullscreen();\n            }\n            else\n            {\n                this.scale.startFullscreen();\n            } \n        }, this);\n    btnSalirFin2.on('pointerover', () => { OnPointeroverBtnSalirFin2 (this); });\n}\nfunction OnPointerdownBtnJugarFin2 (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnJugarFin2');\n    miContexto.scene.switch('game');\n}\nfunction OnPointeroverBtnJugarFin2 (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnJugarFin2');\n}\n    \nfunction OnPointerdownBtnSalirFin2 (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnSalirFin2');\n    if(audioFondo.isPlaying)audioFondo.pause();\n    \/\/GoFullScreen(miContexto);\n    miContexto.scene.switch('title');\n}\nfunction OnPointeroverBtnSalirFin2 (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnSalirFin2');\n}\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/PANTALLA FIN 3\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\npantallaFin3Scene.preload = function()\n{\n    \/*\n    this.load.image('fondoFin3', 'assets\/Juego_Frutas_PantallaFin3.jpg');\n    this.load.image('btnJugarFin3', 'assets\/boton_jugar.png');\n    this.load.image('btnSalirFin3', 'assets\/boton_salir.png');\n    *\/\n}  \npantallaFin3Scene.create = function()\n{\n    \/\/for mouse position\n    inputMouse = this.input;\n    \n    \/\/FONDO \n    fondoFin3 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT \/ 2, 'fondoFin3');\n    \n    \/\/BTN JUGAR\n    \/\/btnJugarFin3 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 265, 'btnJugarFin3');\n    btnJugarFin3 = this.add.image(DEFAULT_WIDTH \/ 2 - 250, DEFAULT_HEIGHT - 265, 'btnJugarFin3');\n    btnJugarFin3.setInteractive({ });\/\/necesario para que reciba eventos\n    btnJugarFin3.on('pointerdown', () => { OnPointerdownBtnJugarFin3 (this); });\n    btnJugarFin3.on('pointerover', () => { OnPointeroverBtnJugarFin3 (this); });\n    \n    \/\/BTN INSTRUCCIONES\n    \/\/btnSalirFin3 = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT - 100, 'btnSalirFin3');\n    btnSalirFin3 = this.add.image(DEFAULT_WIDTH \/ 2 + 250, DEFAULT_HEIGHT - 265, 'btnSalirFin3');\n    btnSalirFin3.setInteractive({ });\/\/necesario para que reciba eventos\n    \/\/btnSalirFin3.on('pointerdown', () => { OnPointerdownBtnSalirFin3 (this); });\n    btnSalirFin3.on('pointerup', function () {\n            this.scene.switch('title');\n            if(audioFondo.isPlaying)audioFondo.pause();\n            if (this.scale.isFullscreen)\n            {\n                this.scale.stopFullscreen();\n            }\n            else\n            {\n                this.scale.startFullscreen();\n            } \n        }, this);\n    btnSalirFin3.on('pointerover', () => { OnPointeroverBtnSalirFin3 (this); });\n}\nfunction OnPointerdownBtnJugarFin3 (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnJugarFin3');\n    miContexto.scene.switch('game');\n}\nfunction OnPointeroverBtnJugarFin3 (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnJugarFin3');\n}\n    \nfunction OnPointerdownBtnSalirFin3 (miContexto)\n{\n    \/\/console.log('OnPointerdownBtnSalirFin3');\n    if(audioFondo.isPlaying)audioFondo.pause();\n    \/\/GoFullScreen(miContexto);\n    miContexto.scene.switch('title');\n}\nfunction OnPointeroverBtnSalirFin3 (miContexto)\n{\n    \/\/console.log('OnPointeroverBtnSalirFin3');\n}\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    \ngameScene.preload = function()\n{\n    \/*this.load.image('fondo', 'assets\/Fondo_Cocina_solo.jpg');\n    this.load.image('plato', 'assets\/plato.png');\n    this.load.image('fondoPuntos', 'assets\/PUNTOSESC.png');\n    this.load.image('fondoTiempo', 'assets\/tiempoESC.png');\n    \n    this.load.audio('acierto', [\n        'assets\/audios\/ACIERTO2.mp3'\n    ], {\n        instances: 1\n    });\n    this.load.audio('fallo', [\n        'assets\/audios\/FALLO2.mp3'\n    ], {\n        instances: 1\n    });\n    \n    for (i = 0; i < alimentosSaludables.length; i++) \n    {\n        this.load.image('alimentoSaludable' + i, 'assets\/PERSONAJES\/' + alimentosSaludables[i]);\/\/76 x 76\n    }\n    for (i = 0; i < alimentosNoSaludables.length; i++) \n    {\n        this.load.image('alimentoNoSaludable' + i, 'assets\/PERSONAJES\/' + alimentosNoSaludables[i]);\/\/76 x 76\n    }\n    \n    this.load.image('star', 'assets\/star.png');\/\/380 x 130\n    this.load.image('bomb', 'assets\/bomb.png');\/\/380 x 130\n    this.load.spritesheet('dude', 'assets\/dude.png', { frameWidth: 32, frameHeight: 48 });*\/\n}\n\ngameScene.create = function()\n{\n    timerCount = maxTime;\n    orientation = this.game.scale.orientation; \n    if (window.screen.width > window.screen.height) \n    {\n        \/\/console.log('LANDSCAPE');\n    } \n    else\n    {\n        \/\/console.log('PORTRAIT');\n    }\n    \n    \n    \/\/for mouse position\n    inputMouse = this.input;\n    worldBounds=this.physics.world.bounds;\n    \n    \/\/audioAcierto = this.sound.add('acierto');\n    \/\/audioFallo = this.sound.add('fallo');\n    \n    \/\/audioAcierto = this.add.audio('acierto');\n    \/\/audioFallo = this.add.audio('fallo');\n\n    \/\/FONDO \n    fondo = this.add.image(DEFAULT_WIDTH \/ 2, DEFAULT_HEIGHT \/ 2, 'fondo');\n    fondo.setDepth(-2);\n    \n    \/\/FONDO PUNTOS\n    fondoPuntos = this.add.image(DEFAULT_WIDTH - 220, 100, 'fondoPuntos');\n    \/\/The score\n    scoreText = this.add.text(DEFAULT_WIDTH - 290, 55, '000', {fontFamily: 'font1', fontSize: '80px', fill: '#eeeee2' });\n    \n    \/\/FONDO TIEMPO\n    fondoTiempo = this.add.image(220, 100, 'fondoTiempo');\n    \/\/The timing\n    timerText = this.add.text(190, 55, '60', {fontFamily: 'font1', fontSize: '80px', fill: '#007f80' });\n    \n\n    \/\/  The platforms group contains the ground and the 2 ledges we can jump on\n    \/\/platforms = this.physics.add.staticGroup();\n\n    \/\/  Here we create the ground.\n    \/\/  Scale it to fit the width of the game (the original sprite is 400x32 in size)\n    \/\/platforms.create(400, 568, 'ground').setScale(2).refreshBody();\n\n    \/\/  Now let's create some ledges\n    \/\/platforms.create(600, 400, 'ground');\n    \/\/platforms.create(50, 250, 'ground');\n    \/\/platforms.create(750, 220, 'ground');\n\n    \/\/ The player and its settings\n    ConfigPlayer(this);\n    \n    \/\/MANO OK\n    manoOK = this.add.image(DEFAULT_WIDTH\/2, posYIniManosAciertoFallo, 'manoOK');\n    \/\/MANO OK\n    manoMAL = this.add.image(DEFAULT_WIDTH\/2, posYIniManosAciertoFallo, 'manoMAL');\n \n    manoOK.visible = false;\n    manoMAL.visible = false;\n    \n    \n    img5ptos = this.add.image(220, 100, '5ptos');\n    img10ptos = this.add.image(220, 100, '10ptos');\n    \n    img5ptos.visible = false;\n    img10ptos.visible = false;\n    \n    img5ptos.setPosition(DEFAULT_WIDTH\/2, 110);\n    img10ptos.setPosition(DEFAULT_WIDTH\/2, 110);\n    \n    pointText = this.add.text(DEFAULT_WIDTH - 290, 55, '000', {fontFamily: 'font1', fontSize: '80px', fill: '#007f80' });\n    pointText.visible = false;\n    \n    \/\/ Input Events\n    cursors = this.input.keyboard.createCursorKeys();\n\n    this.input.on('pointerdown', function(pointer){\n        mouseXAnt = pointer.x;\n        mouseYAnt = pointer.y;\n        deteccMvto = true;\n    });\n    this.input.on('pointerup', function(pointer){\n        deteccMvto = false;\n    });\n\n    alimentosSaludablesGO = this.physics.add.group();\n    alimentosNoSaludablesGO = this.physics.add.group();\n\n    \n    \/\/scoreText.setText('W:H: ' + window.screen.width + \":\" + window.screen.height);\n    \n    player.setInteractive({ });\/\/necesario para que reciba eventos\n    player.on('pointerdown', () => { OnPointerdownPlayer (); });\n    player.on('pointerover', () => { OnPointeroverPlayer (); });\n    player.on('pointerup', () => { OnPointerupPlayer (); });\n    \n    \n    this.physics.add.overlap(player, alimentosSaludablesGO, hitSaludable, null, this);\n    this.physics.add.overlap(player, alimentosNoSaludablesGO, hitNoSaludable, null, this);\n    \/\/this.physics.add.collider(player, alimentosSaludables, hitObject, null, this);\n    \n    \/\/ Stretch to fill\n    \/\/game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;\n    \n    \/\/ Each 1000 ms call onEvent\n    timedEvent = this.time.addEvent({ delay: 1000, callback: onEventTimer, callbackScope: this, loop: true });\n    \n    this.game.scale.on('orientationchange', function(orientation) \n    {\n        \/\/scoreText.setText('W:H: ' + window.screen.width + \":\" + window.screen.height);\n        if (orientation === Phaser.Scale.PORTRAIT) \n        {\n            \/\/this.game.scale.mode = Phaser.Scale.WIDTH_CONTROLS_HEIGHT;\n            \/\/console.log('PORTRAIT');\n            enLandscape = false;\n            \n        } \n        else if (orientation === Phaser.Scale.LANDSCAPE) \n        {\n            \/\/this.game.scale.mode = Phaser.Scale.WIDTH_CONTROLS_WIDTH;\n            \/\/console.log('LANDSCAPE');\n            enLandscape = true;\n        }\n    });\n}\n\nfunction GoFullScreen(contexto)\n{\n    if (contexto.scale.isFullscreen)\n    {\n        contexto.scale.stopFullscreen();\n    }\n    else\n    {\n        contexto.scale.startFullscreen();\n    } \n}\n\nfunction ConfigPlayer(miEscena)\n{\n    \/\/player = miEscena.physics.add.sprite(455, 213, 'plato');\/\/platoRedu\n    player = miEscena.physics.add.sprite(325, 133, 'platoRedu');\n    playerReal = miEscena.add.image(455, 213, 'plato');\n    player.body.setAllowGravity(false);\n    player.x = DEFAULT_WIDTH \/ 2;\n    player.y = DEFAULT_HEIGHT - 268;   \n    playerReal.x = DEFAULT_WIDTH \/ 2;\n    playerReal.y = DEFAULT_HEIGHT - 268;   \n}\n    \nfunction OnPointerdownPlayer ()\n{\n    playerSelecc = true;\n    \/\/console.log('OnPointerdownPlayer');\n}\nfunction OnPointeroverPlayer ()\n{\n    \/\/console.log('OnPointeroverPlayer');\n}\nfunction OnPointerupPlayer ()\n{\n    playerSelecc = false;\n    \/\/console.log('OnPointerupPlayer');\n}\n     \nfunction onEventTimer ()\n{ \n    timerCount -= 1; \/\/ One second    \n    timerText.setText(timerCount);\n      \n    var posFruta = Phaser.Math.Between(0, DEFAULT_WIDTH);\n    \/\/console.log('posFruta ' + posFruta);\n    \n    \/*for (i = 0; i < alimentosSaludables.length; i++) \n    {\n        this.load.image('alimentoSaludable' + i, 'assets\/PERSONAJES\/' + alimentosSaludables[i]);\/\/76 x 76\n    }\n    for (i = 0; i < alimentosNoSaludables.length; i++) \n    {\n        this.load.image('alimentoNoSaludable' + i, 'assets\/PERSONAJES\/' + alimentosNoSaludables[i]);\/\/76 x 76\n    }*\/\n    \n    var tipoFruta = getRndInteger(0, 2);\/\/0,1 \n    if(tipoFruta == 0)\/\/alimentoSaludable\n    {\n        var numAlimSaluSelecc = getRndInteger(0, alimentosSaludables.length); \n        var nombreAlimentoSelecc = 'alimentoSaludable' + numAlimSaluSelecc;\n        \n        var miAlimActual = alimentosSaludablesGO.create(posFruta, 0, nombreAlimentoSelecc);\n        miAlimActual.setVelocity(0, Phaser.Math.Between(-50, 50));\n        miAlimActual.allowGravity = false;\n        miAlimActual.setScale(DEFAULT_WIDTH * 0.2 \/ miAlimActual.width);\n        miAlimActual.setDepth(-1);\n        \n        alimentosSaludablesGO.add(miAlimActual);\n    }\n    else\/\/alimentosNoSaludables\n    {\n        var numAlimNoSaluSelecc = getRndInteger(0, alimentosNoSaludables.length); \n        var nombreAlimentoSelecc = 'alimentoNoSaludable' + numAlimNoSaluSelecc;\n        \n        var miAlimActual = alimentosNoSaludablesGO.create(posFruta, 0, nombreAlimentoSelecc);\n        miAlimActual.setVelocity(0, Phaser.Math.Between(-50, 50));\n        miAlimActual.allowGravity = false;\n        miAlimActual.setScale(DEFAULT_WIDTH * 0.2 \/ miAlimActual.width);\n        miAlimActual.setDepth(-1);\n        \n        alimentosNoSaludablesGO.add(miAlimActual);\n    }\n    \n\n    if(timerCount <= 0)\/\/fin juego\n    {\n        \/\/console.log('fin del juego ');\n        \/\/timedEvent.paused = true;\n        \n        if(miPuntuacion <= ptosPantalla1)\n        {\n             this.scene.switch('pantallaFin1');   \n        }\n        else if((miPuntuacion > ptosPantalla1) && (miPuntuacion <= ptosPantalla2))\n        {\n             this.scene.switch('pantallaFin2');   \n        }\n        else\n        {\n            this.scene.switch('pantallaFin3');       \n        }\n        ResetGame();\n    }\n}\n    \nfunction ResetGame()\n{\n    alimentosNoSaludablesGO.clear(true, true);\n    alimentosSaludablesGO.clear(true, true);\n    timerCount = maxTime;\n    miPuntuacion = 0;\n    scoreText.setText(\"000\");\n    timerText.setText(timerCount);\n    pointText.setText(\"\");\n}\n    \nfunction hitSaludable (player, alimSaludable)\n{\n    miPuntuacion += PTOSBONIF;\n    \n    if(contTextoPtos != null)contTextoPtos.remove();\n    contTextoPtos = this.time.delayedCall(timeDelayedCallMostrarAciertoFall0, onContEventTimer, [], this);\n    pointText.x = alimSaludable.x;\n    pointText.y = alimSaludable.y;\n    pointText.setText(\"+\" + PTOSBONIF + \"pts\");\n    \n    \/\/img10ptos.x = player.x;\n    \/\/img10ptos.y = player.y;\n    img10ptos.visible = true;\n    manoOK.visible = true;\n    \n    enAnimAcierto = true;\n    enAnimFallo = false;\n    subiendoFallo = true;\n    manoMAL.y = posYIniManosAciertoFallo;\n    \n    if(img5ptos.visible == true)\n        {\n            img5ptos.visible = false;\n        }\n    if(manoMAL.visible == true)\n        {\n            manoMAL.visible = false;\n        }\n    \n    alimSaludable.destroy();\n    \/\/this.physics.pause();\n\n    \/\/playerReal.setTint(0x86B07E);\n\n\n    \/\/this.scene.switch('title');\n    \/\/console.log('objeto saludable ');\n    \n    UpdateScore(miPuntuacion);\n}\nfunction hitNoSaludable (player, alimNoSaludable)\n{\n    miPuntuacion -= PTOSELIMINAR;\n    \n    if(miPuntuacion < 0) \n    {\n        miPuntuacion = 0;\n        \n        enAnimAcierto = false;\n        manoOK.rotation = 0;\n        subiendoAcierto = true;\n        \n        contTextoPtos = this.time.delayedCall(timeDelayedCallMostrarAciertoFall0, onContEventTimer, null, this);\n        enAnimFallo = true;\n        manoMAL.visible = true;\n        if(manoOK.visible == true)\n        {\n            manoOK.visible = false;\n        }\n    }\n    else\n    {\n        if(contTextoPtos != null)contTextoPtos.remove();\n        contTextoPtos = this.time.delayedCall(timeDelayedCallMostrarAciertoFall0, onContEventTimer, null, this);\n        pointText.x = alimNoSaludable.x;\n        pointText.y = alimNoSaludable.y;\n        pointText.setText(\"-\" + PTOSELIMINAR + \"pts\");   \n        \n        \/\/img5ptos.x = player.x;\n        \/\/img5ptos.y = player.y;\n        img5ptos.visible = true;\n        manoMAL.visible = true;\n        \n        enAnimAcierto = false;\n        manoOK.rotation = 0;\n        subiendoAcierto = true;\n        \n        enAnimFallo = true;\n        \n        if(img10ptos.visible == true)\n            {\n                img10ptos.visible = false;\n            }\n        if(manoOK.visible == true)\n        {\n            manoOK.visible = false;\n        }\n    \n    }\n    \n    alimNoSaludable.destroy();\n    \/\/this.physics.pause();\n\n    \/\/playerReal.setTint(0xB07D81);\n\n\n    \/\/this.scene.switch('title');\n    \/\/console.log('objeto NO saludable ');\n    \n    \/\/gameOver = true;\n    \n    UpdateScore(miPuntuacion);\n}\nfunction onContEventTimer()\n{\n    contTextoPtos = null;\n    pointText.setText(\"\");  \n    \n    \/\/playerReal.setTint(0xffffff);\n    \n    img10ptos.visible = false;\n    img5ptos.visible = false;\n    \n    manoOK.visible = false;\n    manoMAL.visible = false;\n}\n    \nfunction UpdateScore(miPuntuacion)\n{\n    var ptosVer = miPuntuacion;\n    if(miPuntuacion < 10)ptosVer = \"00\" + miPuntuacion;\n    else if(miPuntuacion < 100)ptosVer = \"0\" + miPuntuacion;\n    scoreText.setText(ptosVer);\n}\n    \nfunction getRndInteger(min, max) {return Math.floor(Math.random() * (max - min)) + min;}\n\ngameScene.update = function()\n{\n    \/\/console.log(\"Num alims:\" + alimentosNoSaludablesGO.getChildren().length);\n    if (gameOver)\n    {\n        return;\n    }\n    \n    if(deteccMvto == true)\n        {\n            deltaMouseX = mouseXAnt - inputMouse.x;\n            deltaMouseY = mouseYAnt - inputMouse.y;\n\n            mouseXAnt = inputMouse.x;\n            mouseYAnt = inputMouse.y;\n            \n            player.setPosition(player.x - deltaMouseX, player.y);\n            \n            \/\/img10ptos.setPosition(player.x, player.y);\n            \/\/img5ptos.setPosition(player.x, player.y);\n            \n            CheckPlayerLimits();\n            playerReal.setPosition(player.x, player.y);\n        }\n    \n    if (cursors.left.isDown)\n    {\n        player.setPosition(player.x - velMvtoTecla, player.y);\n        \/\/player.setVelocityX(-160);\n        \/\/player.anims.play('left', true);\n        \n        \/\/img10ptos.setPosition(player.x, player.y);\n        \/\/img5ptos.setPosition(player.x, player.y);\n        \n        CheckPlayerLimits();\n        playerReal.setPosition(player.x, player.y);\n    }\n    else if (cursors.right.isDown)\n    {\n        player.setPosition(player.x + velMvtoTecla, player.y);\n        \/\/player.setVelocityX(160);\n        \/\/player.anims.play('right', true);\n        \n        \/\/img10ptos.setPosition(player.x, player.y);\n        \/\/img5ptos.setPosition(player.x, player.y);\n        \n        CheckPlayerLimits();\n        playerReal.setPosition(player.x, player.y);\n    }\n    \/\/else\n    \/\/{\n        \/\/player.setVelocityX(0);\n        \/\/player.anims.play('turn');\n    \/\/}\n\n    \/\/if (cursors.up.isDown && player.body.touching.down)\n    \/\/{\n    \/\/    player.setVelocityY(-330);\n    \/\/}\n    \n    if(enAnimAcierto == true)\n    {\n        \/\/console.log('manoOK.rotation: ' + manoOK.rotation);\n        \n        if(subiendoAcierto == true)\n        {\n            if(manoOK.rotation < 0.785)\/\/pi\/4 , 45\u0e22\u0e1a\n            {\n                manoOK.rotation += 0.035;\n            }\n            else\n            {\n                manoOK.rotation = 0.785;\n                subiendoAcierto = false;\n            }\n        }\n        else\n        {\n            if(manoOK.rotation > 0)\/\/pi\/4 , 45\u0e22\u0e1a\n            {\n                manoOK.rotation -= 0.035;\n            }\n            else\n            {\n                manoOK.rotation = 0;\n                subiendoAcierto = true;\n                enAnimAcierto = false;\n            }\n        }\n        \n           \/\/manoOK\n    }\n    \n    if(enAnimFallo == true)\n    {\n        \/\/console.log('manoMAL.y: ' + manoMAL.y);\n        if(subiendoFallo == true)\n        {\n            if(manoMAL.y < posYIniManosAciertoFallo + posYIniManosAciertoFallo\/6)\n            {\n                manoMAL.y += 8;\n            }\n            else\n            {\n                manoMAL.y = posYIniManosAciertoFallo + posYIniManosAciertoFallo\/6;\n                subiendoFallo = false;\n            }\n        }\n        else\n        {\n            if(manoMAL.y > posYIniManosAciertoFallo)\n            {\n                manoMAL.y -= 8;\n            }\n            else\n            {\n                manoMAL.y = posYIniManosAciertoFallo;\n                subiendoFallo = true;\n                enAnimFallo = false;\n            }\n        }  \n    }\n    \/\/posYIniManosAciertoFallo\n    \/\/enAnimAcierto = false;\n    \/\/enAnimFallo = true;\n}\n\nfunction CheckPlayerLimits()\n{\n    if(player.x < 0)player.x = 0;\n    if(player.x > DEFAULT_WIDTH)player.x = DEFAULT_WIDTH;\n    \n    if(playerReal.x < 0)playerReal.x = 0;\n    if(playerReal.x > DEFAULT_WIDTH)playerReal.x = DEFAULT_WIDTH;\n}\n\n<\/script><\/div><\/div><style type=\"text\/css\">.fusion-body .fusion-builder-column-0{width:100% !important;margin-top : 0px;margin-bottom : 20px;}.fusion-builder-column-0 > .fusion-column-wrapper {padding-top : 0px !important;padding-right : 0px !important;margin-right : 1.92%;padding-bottom : 0px !important;padding-left : 0px !important;margin-left : 1.92%;}@media only screen and (max-width:1024px) {.fusion-body .fusion-builder-column-0{width:100% !important;order : 0;}.fusion-builder-column-0 > .fusion-column-wrapper {margin-right : 1.92%;margin-left : 1.92%;}}@media only screen and (max-width:640px) {.fusion-body .fusion-builder-column-0{width:100% !important;order : 0;}.fusion-builder-column-0 > .fusion-column-wrapper {margin-right : 1.92%;margin-left : 1.92%;}}<\/style><\/div><style type=\"text\/css\">.fusion-body .fusion-flex-container.fusion-builder-row-1{ padding-top : 0px;margin-top : 0px;padding-right : 30px;padding-bottom : 0px;margin-bottom : 0px;padding-left : 30px;}<\/style><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-105","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Juega con tus h\u00e9roes | Pon m\u00e1s h\u00e9roes en tu plato | Ministerio de Consumo<\/title>\n<meta name=\"description\" content=\"Te retamos a que pongas m\u00e1s frutas, verduras y legumbres en tu plato y que dejes de lado los alimentos menos saludables.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Juega con tus h\u00e9roes | Pon m\u00e1s h\u00e9roes en tu plato | Ministerio de Consumo\" \/>\n<meta property=\"og:description\" content=\"Te retamos a que pongas m\u00e1s frutas, verduras y legumbres en tu plato y que dejes de lado los alimentos menos saludables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/\" \/>\n<meta property=\"og:site_name\" content=\"Pon m\u00e1s h\u00e9roes en tu plato\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-08T08:01:20+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/\",\"url\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/\",\"name\":\"Juega con tus h\u00e9roes | Pon m\u00e1s h\u00e9roes en tu plato | Ministerio de Consumo\",\"isPartOf\":{\"@id\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/#website\"},\"datePublished\":\"2020-10-19T11:30:46+00:00\",\"dateModified\":\"2024-05-08T08:01:20+00:00\",\"description\":\"Te retamos a que pongas m\u00e1s frutas, verduras y legumbres en tu plato y que dejes de lado los alimentos menos saludables.\",\"breadcrumb\":{\"@id\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Juega con tus h\u00e9roes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/#website\",\"url\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/\",\"name\":\"Pon m\u00e1s h\u00e9roes en tu plato\",\"description\":\"Pon m\u00e1s h\u00e9roes en tu plato\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Juega con tus h\u00e9roes | Pon m\u00e1s h\u00e9roes en tu plato | Ministerio de Consumo","description":"Te retamos a que pongas m\u00e1s frutas, verduras y legumbres en tu plato y que dejes de lado los alimentos menos saludables.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/","og_locale":"es_ES","og_type":"article","og_title":"Juega con tus h\u00e9roes | Pon m\u00e1s h\u00e9roes en tu plato | Ministerio de Consumo","og_description":"Te retamos a que pongas m\u00e1s frutas, verduras y legumbres en tu plato y que dejes de lado los alimentos menos saludables.","og_url":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/","og_site_name":"Pon m\u00e1s h\u00e9roes en tu plato","article_modified_time":"2024-05-08T08:01:20+00:00","twitter_card":"summary_large_image","twitter_misc":{"Tiempo de lectura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/","url":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/","name":"Juega con tus h\u00e9roes | Pon m\u00e1s h\u00e9roes en tu plato | Ministerio de Consumo","isPartOf":{"@id":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/#website"},"datePublished":"2020-10-19T11:30:46+00:00","dateModified":"2024-05-08T08:01:20+00:00","description":"Te retamos a que pongas m\u00e1s frutas, verduras y legumbres en tu plato y que dejes de lado los alimentos menos saludables.","breadcrumb":{"@id":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/juega-con-tus-heroes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/"},{"@type":"ListItem","position":2,"name":"Juega con tus h\u00e9roes"}]},{"@type":"WebSite","@id":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/#website","url":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/","name":"Pon m\u00e1s h\u00e9roes en tu plato","description":"Pon m\u00e1s h\u00e9roes en tu plato","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"}]}},"_links":{"self":[{"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/pages\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":2,"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/pages\/105\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/pages\/105\/revisions\/144"}],"wp:attachment":[{"href":"https:\/\/portfolio.2ados.es\/pon-mas-heroes-en-tu-plato\/wp-json\/wp\/v2\/media?parent=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}