Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var numeSalon = "";
- var limba;
- var nivelSelectat;
- var sumaInceput;
- var scorPropus;
- var highScore;
- var timp = 0;
- var x = 3;
- var locuri = new Array();
- var interval_om;
- var interval_timp;
- var apasat = false;
- var lastClicked;
- var nr_vieti;
- var viteza_aparitie;
- var caracter_apasat;
- var coord_x_mouse;
- var coord_y_mouse;
- var start;
- var contor_par = 0;
- window.onmousemove = function(e)
- {
- coord_x_mouse = e.pageX;
- coord_y_mouse = e.pageY;
- }
- for(var i=0; i<12; i++)
- {
- locuri.push(false);
- }
- class loader
- {
- constructor()
- {
- this.imagini=new Object();
- this.sunete={};
- this.mesaje={};
- this.limba;
- }
- getImagine(id){
- var L = this;
- if(L.imagini[id].aparitie == "multipla")
- {
- var aux = L.imagini[id];
- var im_nou = document.createElement("img");
- im_nou.src = L.imagini[id].src;
- im_nou.w = L.imagini[id].w;
- im_nou.h = L.imagini[id].h;
- im_nou.aparitie = L.imagini[id].aparitie;
- L.imagini[id] = im_nou;
- return aux;
- }
- else
- return L.imagini[id];
- }
- getSunet(id)
- {
- var L = this;
- return L.sunete[id];
- }
- getMesaj(id)
- {
- var L = this;
- return L.mesaje[id];
- }
- getLimba()
- {
- return this.limba;
- }
- /*getVitezaAparitie()
- {
- return this.viteza_aparitie;
- }*/
- //getNrVieti()
- //{
- // return this.nr_vieti;
- //}
- parseResources()
- {
- var L = this;
- $.ajax({
- url: "resurse.xml",
- type:"GET",
- dataType: "xml",
- success: function(xml)
- {
- var $xml = $(xml);
- var $imagini = $xml.find( "imagine" );
- $imagini.each(function(i){
- var cale=$(this).text();
- var id = $(this).attr("id");
- var w = $(this).attr("w");
- var h = $(this).attr("h");
- var aparitie = $(this).attr("aparitie");
- var imagine = document.createElement("img");
- imagine.src = cale;
- L.imagini[id]=imagine;
- L.imagini[id].aparitie = aparitie;
- L.imagini[id].w=w;
- L.imagini[id].h=h;
- });
- var $sunete = $xml.find("sunet");
- $sunete.each(function(i){
- var sunet = document.createElement("audio");
- var cale = $(this).text();
- sunet.src = cale;
- var id = $(this).attr("id");
- L.sunete[id]=sunet;
- });
- x--;
- },
- error: function(err){
- alert(err);
- }
- });
- $.ajax({
- url: "mesaje.xml",
- type: "GET",
- dataType: "xml",
- success: function(xml)
- {
- var $xml = $(xml);
- var $mesaje = $xml.find("mesaje[lang=\"" + L.getLimba() + "\"]");
- $mesaje.each(function(i)
- {
- var id = $(this).attr("id");
- L.mesaje[id] = $(this).text();
- });
- x--;
- },
- error: function(err){
- alert(err);
- }
- });
- $.ajax
- ({
- url: "setari.xml",
- type: "GET",
- dataType: "xml",
- success: function(xml)
- {
- var vtz, nr_vt;
- var $xml = $(xml);
- var nivel = $xml.find("nivel" + nivelSelectat);
- nr_vieti = parseInt(nivel.attr("nr_vieti"));
- viteza_aparitie = parseInt(nivel.attr("viteza_aparitie"));
- x--;
- },
- error: function(err){
- alert(err);
- }
- });
- }
- }
- function updateClock() {
- var now = new Date(),
- months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'September', 'November', 'December'];
- time = now.getHours() + ':' + now.getMinutes() ,
- date = [now.getDate(),
- months[now.getMonth()],
- now.getFullYear()].join(' ');
- document.getElementById('time').innerHTML = [date, time].join(' / ');
- document.getElementById('time').style.position = "absolute";
- document.getElementById('time').style.top = "0";
- setTimeout(updateClock, 1000);
- }
- /*function updateTimp()
- {
- document.getElementById("div_timp").innerHTML = "Timp(Time): " + timp;
- timp++;
- interval_timp = setTimeout(updateTimp, 1000);
- }*/
- window.setInterval((function()
- {
- return function()
- {
- if(document.getElementById("div_timp") != null)
- {
- document.getElementById("div_timp").innerHTML = "Timp(Time): " + (Math.floor((Date.now()-start)/1000) + 1);
- timp = (Math.floor((Date.now()-start)/1000) + 1)
- }
- };
- }()), 1000);
- function rand(a,b)
- {
- return Math.floor(Math.random() * b) + a;
- }
- class Joc
- {
- constructor()
- {
- }
- init(L)
- {
- start = Date.now();
- document.getElementById("container_setari").style.display = "none";
- document.getElementById("container_joc").style.display = "block";
- var nume = document.createElement("h2");
- nume.id = "nume";
- nume.innerHTML = numeSalon;
- nume.style.marginLeft = "900px";
- document.body.insertBefore(nume, document.getElementById("container_joc"));
- var div_scor = document.createElement("div");
- div_scor.style.position = "absolute";
- div_scor.style.left = "10px";
- div_scor.style.top = "30px";
- div_scor.id = "div_scor";
- div_scor.innerHTML = "High Score(minutes): " + highScore;
- document.body.appendChild(div_scor);
- var div_suma = document.createElement("div");
- div_suma.style.position = "absolute";
- div_suma.style.left = "10px";
- div_suma.style.top = "60px";
- div_suma.id = "div_suma"
- div_suma.innerHTML = "Suma bani(Money): " + sumaInceput;
- document.body.appendChild(div_suma);
- updateClock();
- var div_timp = document.createElement("div");
- div_timp.style.position = "absolute";
- div_timp.style.left = "10px";
- div_timp.style.top = "90px";
- div_timp.id = "div_timp";
- document.body.appendChild(div_timp);
- //updateTimp();
- var div_scor_propus = document.createElement("div");
- div_scor_propus.style.position = "absolute";
- div_scor_propus.style.left = "10px";
- div_scor_propus.style.top = "120px";
- div_scor_propus.innerHTML = "Scor propus(Score to attain): " + scorPropus;
- div_scor_propus.id = "div_scor_propus";
- document.body.appendChild(div_scor_propus);
- var div_nr_vieti = document.createElement("div");
- div_nr_vieti.style.position = "absolute";
- div_nr_vieti.style.left = "10px";
- div_nr_vieti.style.top = "150px";
- div_nr_vieti.innerHTML = "Numar vieti(Health Points): " + nr_vieti;
- div_nr_vieti.id = "div_nr_vieti";
- document.body.appendChild(div_nr_vieti);
- interval_om = setInterval(function(){spawneaza_om(L);}, viteza_aparitie * 1000);
- window.onkeypress = function(e)
- {
- var cod = e.which;
- var caracter = String.fromCharCode(cod);
- if(!e.ctrlKey)
- {
- if(caracter == "r")
- {
- if(apasat == false)
- {
- if(sumaInceput >= 50)
- {
- caracter_apasat = "r"
- apasat = true;
- var camera;
- camera = document.createElement("div");
- camera.style.position = "absolute";
- camera.style.backgroundColor = "red";
- camera.style.width = "120px";
- camera.style.height = "120px";
- camera.className = "camera";
- camera.style.left = coord_x_mouse - 435 + "px";
- camera.style.top = coord_y_mouse - 110 + "px";
- document.getElementById("container_joc").appendChild(camera);
- document.getElementById("container_joc").onmousemove = function(e)
- {
- var aux = document.getElementsByClassName("camera");
- var index = aux.length;
- document.getElementsByClassName("camera")[index-1].style.left = e.pageX - 435 + "px";
- document.getElementsByClassName("camera")[index-1].style.top = e.pageY - 110 + "px";
- } ;
- }
- else
- alert("Suma insuficienta");
- }
- }
- if(caracter == "v")
- {
- if(apasat == false)
- {
- if(sumaInceput >= 50)
- {
- caracter_apasat = "v";
- apasat = true;
- var camera;
- camera = document.createElement("div");
- camera.style.position = "absolute";
- camera.style.backgroundColor = "green";
- camera.style.width = "120px";
- camera.style.height = "120px";
- camera.className = "camera";
- camera.style.left = coord_x_mouse - 435 + "px";
- camera.style.top = coord_y_mouse - 110 + "px";
- document.getElementById("container_joc").appendChild(camera);
- document.getElementById("container_joc").onmousemove = function(e)
- {
- var aux = document.getElementsByClassName("camera");
- var index = aux.length;
- document.getElementsByClassName("camera")[index-1].style.left = e.pageX - 435 + "px";
- document.getElementsByClassName("camera")[index-1].style.top = e.pageY - 110 + "px";
- } ;
- }
- else
- alert("Suma insuficienta");
- }
- }
- if(caracter == "a")
- {
- if(apasat == false)
- {
- if(sumaInceput >=50)
- {
- caracter_apasat = "a";
- apasat = true;
- var camera;
- camera = document.createElement("div");
- camera.style.position = "absolute";
- camera.style.backgroundColor = "blue";
- camera.style.width = "120px";
- camera.style.height = "120px";
- camera.className = "camera";
- camera.style.left = coord_x_mouse - 435 + "px";
- camera.style.top = coord_y_mouse - 110 + "px";
- document.getElementById("container_joc").appendChild(camera);
- document.getElementById("container_joc").onmousemove = function(e)
- {
- var aux = document.getElementsByClassName("camera");
- var index = aux.length;
- document.getElementsByClassName("camera")[index-1].style.left = e.pageX - 435 + "px";
- document.getElementsByClassName("camera")[index-1].style.top = e.pageY - 110 + "px";
- } ;
- }
- else
- alert("Suma insuficienta");
- }
- }
- }
- }
- window.onkeyup = function(e)
- {
- var cod = e.which;
- var caracter = String.fromCharCode(cod);
- if((caracter == "R" || caracter == "V" || caracter == "A") && (caracter.toLowerCase() == caracter_apasat))
- {
- var camere = document.getElementsByClassName("camera");
- var sw = true;
- for(var i=0; i<camere.length-1; i++)
- {
- var stil1 = getComputedStyle(camere[i]);
- var stil2 = getComputedStyle(camere[camere.length-1]);
- var coliziune = test_coliziune(parseInt(stil1.top),parseInt(stil1.left),parseInt(stil1.height),parseInt(stil1.width),
- parseInt(stil2.top),parseInt(stil2.left),parseInt(stil2.height),parseInt(stil2.width));
- if(coliziune)
- {
- alert("Coliziune");
- document.getElementById("container_joc").onmousemove = null;
- document.getElementById("container_joc").removeChild(camere[camere.length-1]);
- sw = false;
- break;
- }
- }
- if(sw == true)
- {
- var stil2 = getComputedStyle(camere[camere.length-1]);
- if(parseInt(stil2.left) < 0 || parseInt(stil2.top) < 0 || parseInt(stil2.left) > 880 || parseInt(stil2.top) > 480)
- {
- alert("Coliziune");
- document.getElementById("container_joc").onmousemove = null;
- document.getElementById("container_joc").removeChild(camere[camere.length-1]);
- sw = false;
- }
- }
- if(sw == true)
- {
- camere[camere.length-1].setAttribute("ocupat", "0");
- camere[camere.length-1].onclick = function()
- {
- if(lastClicked.className == "div_om" && this.getAttribute("ocupat") == "0" && lastClicked.getAttribute("in_miscare") == "0")
- {
- var sw=true;
- var contor = lastClicked.getElementsByClassName("culoare");
- var i;
- var j;
- for(i=0; i<contor.length; i++)
- {
- if(contor[i].style.backgroundColor == this.style.backgroundColor)
- {
- for(j=0; j<contor.length; j++)
- contor[j].style.display = "none";
- lastClicked.style.backgroundColor = "transparent";
- //locuri[parseInt(lastClicked.id)] = false;
- lastClicked.style.zIndex = "1";
- this.setAttribute("ocupat", "1");
- lastClicked.onclick = null;
- lastClicked.setAttribute("in_miscare", "1");
- var par = lastClicked.getElementsByTagName("div")[0];
- locuri[parseInt(lastClicked.id)] = false;
- var aux = lastClicked;
- miscare_om(aux, parseInt(lastClicked.style.top), parseInt(lastClicked.style.left), 1, 5, (parseInt(this.style.left) - parseInt(lastClicked.style.left) + 15) / 5 ,
- (parseInt(this.style.top) - parseInt(lastClicked.style.top) + 15) / 5, parseInt(this.style.left) + 15 , parseInt(this.style.top) + 15, this, par);
- sw=false;
- break;
- }
- }
- if(sw == true)
- {
- nr_vieti--;
- locuri[parseInt(lastClicked.id)] = false;
- document.getElementById("container_joc").removeChild(lastClicked);
- lastClicked = null;
- document.getElementById("div_nr_vieti").innerHTML = "Numar vieti(Health Points): " + nr_vieti;
- if(nr_vieti == 0)
- gameOver(L);
- }
- }
- else if(lastClicked.className == "div_om" && this.getAttribute("ocupat") == "1")
- alert("Ocupat");
- }
- if(document.getElementById("container_joc").onmousemove == null)
- document.getElementById("container_joc").removeChild(camere[camere.length-1]);
- document.getElementById("container_joc").onmousemove = null;
- sumaInceput -= 50;
- document.getElementById("div_suma").innerHTML = "Suma bani(Money): " + sumaInceput;
- }
- apasat = false;
- }
- }
- }
- }
- miscare_om = function(om , top_r, left_r, pas_c, nr_pasi, dleft, dtop, left_f, top_f, camera, par)
- {
- if (pas_c<nr_pasi)
- {
- top_r+=dtop;
- left_r+=dleft;
- om.style.top=(Math.round(top_r))+"px";
- om.style.left=(Math.round(left_r))+"px";
- pas_c++;
- setTimeout(function () {miscare_om(om , top_r, left_r, pas_c, nr_pasi, dleft, dtop, left_f, top_f, camera, par);}, 400);
- }
- else
- {
- om.style.top=(top_f+"px");
- om.style.left=(left_f+"px");
- //var aux = document.getElementById("div_par" + om.id);
- if(camera.style.backgroundColor == "blue")
- par.animate([
- { background: "#E0E0E0" },
- { background: 'blue' }
- ], {
- duration: 3000,
- iterations: 1
- });
- else if(camera.style.backgroundColor == "red")
- par.animate([
- { background: "#E0E0E0" },
- { background: 'red' }
- ], {
- duration: 3000,
- iterations: 1
- });
- else
- par.animate([
- { background: "#E0E0E0" },
- { background: 'green' }
- ], {
- duration: 3000,
- iterations: 1
- });
- setTimeout(function()
- {
- if(lastClicked === om)
- {
- lastClicked = null;
- }
- camera.setAttribute("ocupat", "0");
- document.getElementById("container_joc").removeChild(om);
- sumaInceput += 20;
- document.getElementById("div_suma").innerHTML = "Suma bani(Money): " + sumaInceput;
- }, 3000)
- }
- }
- function test_coliziune(top1,left1,h1,w1,top2,left2,h2,w2)
- {
- if(left1< left2+ w2 &&
- left1+ w1> left2 &&
- top1 < top2 + h2 &&
- top1 + h1 > top2) {
- return true;
- }
- }
- spawneaza_om = function(L)
- {
- /*var imagine_om = L.getImagine("om");
- var aux = document.createElement("img");
- aux.src = imagine_om.src;
- aux.style.width = imagine_om.w+"px";
- aux.style.height = imagine_om.h+"px";
- aux.style.position = "absolute";
- var i;
- var sw = true;
- for(i=0; i<12; i++)
- if(locuri[i] == false)
- {
- if(i < 6)
- {
- aux.style.left = ((100 * i) + 90 * i) + 55 + "px";
- aux.style.top = "650px";
- document.getElementById("container_joc").appendChild(aux);
- locuri[i] = true;
- sw = false;
- break;
- }
- else
- {
- aux.style.left = ((100 * (i-6)) + 90 * (i-6)) + 55 + "px";
- aux.style.top = "750px";
- document.getElementById("container_joc").appendChild(aux);
- locuri[i] = true;
- sw = false;
- break;
- }
- }
- if(sw == true)
- {
- nr_vieti--;
- document.getElementById("div_nr_vieti").innerHTML = "Numar vieti(Health Points): " + nr_vieti;
- if(nr_vieti == 0)
- gameOver(L);
- }*/
- var ecran = document.getElementById("container_joc");
- var div_om = document.createElement("div");
- div_om.style.position = "absolute";
- div_om.className = "div_om";
- div_om.style.height = "90px";
- div_om.style.width = "90px";
- var imagine_om = L.getImagine("om");
- var aux = document.createElement("img");
- aux.src = imagine_om.src;
- aux.style.width = imagine_om.w+"px";
- aux.style.height = imagine_om.h+"px";
- //aux.style.position = "absolute";
- //imagine_om.style.position = "absolute";
- var i;
- var sw = true;
- for(i=0; i<12; i++)
- if(locuri[i] == false)
- {
- var div_par = document.createElement("div");
- div_par.style.position = "relative";
- div_par.style.width = "80px";
- div_par.style.height = "30px";
- div_par.style.left = "5px";
- div_par.style.top = "-100px";
- //div_par.className = "div_par" + i;
- div_par.style.backgroundColor = "#E0E0E0";
- div_om.appendChild(aux);
- div_om.id = i;
- div_om.style.backgroundColor = "transparent";
- div_om.appendChild(div_par);
- var nr_culori = rand(1, 3);
- if(nr_culori == 1)
- {
- var culoare1 = rand(1, 3);
- if(culoare1 == 1)
- {
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.backgroundColor = "red";
- div_culoare.style.position = "relative";
- div_om.appendChild(div_culoare);
- }
- else if(culoare1 == 2)
- {
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.backgroundColor = "green";
- div_culoare.style.position = "relative";
- div_om.appendChild(div_culoare);
- }
- else
- {
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.backgroundColor = "blue";
- div_culoare.style.position = "relative";
- div_om.appendChild(div_culoare);
- }
- }
- else if(nr_culori == 2)
- {
- var culoare1 = rand(1, 3);
- var culoare2 = rand(1, 3);
- while(culoare2 == culoare1)
- culoare2 = rand(1,3);
- if((culoare1 == 1 && culoare2 == 2) || (culoare1 == 2 && culoare2 == 1))
- {
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "red";
- div_om.appendChild(div_culoare);
- div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "green";
- div_om.appendChild(div_culoare);
- }
- else if((culoare1 == 1 && culoare2 == 3) || (culoare1 == 3 && culoare2 == 1))
- {
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "red";
- div_om.appendChild(div_culoare);
- div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "blue";
- div_om.appendChild(div_culoare);
- }
- else
- {
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "green";
- div_om.appendChild(div_culoare);
- div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "blue";
- div_om.appendChild(div_culoare);
- }
- }
- else
- {
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "red";
- div_om.appendChild(div_culoare);
- var div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "green";
- div_om.appendChild(div_culoare);
- div_culoare = document.createElement("div");
- div_culoare.style.width = "20px";
- div_culoare.style.height = "30px";
- div_culoare.style.marginLeft = "95px";
- div_culoare.style.top = "-120px";
- div_culoare.className = "culoare";
- div_culoare.style.position = "relative";
- div_culoare.style.backgroundColor = "blue";
- div_om.appendChild(div_culoare);
- }
- div_om.onclick = function(e)
- {
- if(lastClicked == this)
- {
- lastClicked = null;
- this.style.backgroundColor = "transparent";
- }
- else
- {
- if(lastClicked != null)
- lastClicked.style.backgroundColor = "transparent";
- lastClicked = this;
- lastClicked.setAttribute("in_miscare", "0");
- this.style.backgroundColor = "yellow";
- }
- }
- if(i < 6)
- {
- div_om.style.left = ((100 * i) + 90 * i) + 55 + "px";
- div_om.style.top = "635px";
- document.getElementById("container_joc").appendChild(div_om);
- locuri[i] = true;
- sw = false;
- break;
- }
- else
- {
- div_om.style.left = ((100 * (i-6)) + 90 * (i-6)) + 55 + "px";
- div_om.style.top = "765px";
- document.getElementById("container_joc").appendChild(div_om);
- locuri[i] = true;
- sw = false;
- break;
- }
- }
- if(sw == true)
- {
- nr_vieti--;
- document.getElementById("div_nr_vieti").innerHTML = "Numar vieti(Health Points): " + nr_vieti;
- if(nr_vieti == 0)
- gameOver(L);
- }
- }
- gameOver = function(L)
- {
- clearInterval(interval_om);
- clearTimeout(interval_timp);
- localStorage.setItem("highScore", Math.floor(timp/60));
- L.getSunet("game_over").play();
- alert("Ai pierdut.");
- location.reload();
- /*var mesaj_sfarsit = L.getMesaj("pierdut");
- mesaj_sfarsit.style.position = absolute;
- mesaj_sfarsit.style.left = "400px";
- mesaj_sfarsit.style.top = "500px";
- document.getElementById("container_joc").appendChild(mesaj_sfarsit);*/
- }
- preluare_date = function()
- {
- var aux = document.getElementById("limba");
- limba = aux.options[aux.selectedIndex].value;
- if(document.getElementById("r1").checked == true)
- nivelSelectat = document.getElementById("r1").value;
- else if(document.getElementById("r2").checked == true)
- nivelSelectat = document.getElementById("r1").value;
- sumaInceput = parseInt(document.getElementById("suma_inceput").value);
- var regexp = /^[0-9]+([,.][0-9]+)?$/g;
- if(document.getElementById("scor_propus").value == "" || regexp.test(document.getElementById("scor_propus").value) != true)
- {
- alert("Introdu scorul propus(doar cifre)");
- return ;
- }
- if(document.getElementById("scor_propus").value == "")
- {
- alert("Introdu scorul propus");
- return ;
- }
- scorPropus = parseInt(document.getElementById("scor_propus").value);
- numeSalon = document.getElementById("nume_salon").value;
- if(numeSalon.length == 0 || numeSalon.length >20)
- {
- alert("Introdu numele salonului(maxim 20 caractere)");
- return ;
- }
- if(localStorage.getItem("highScore") === null)
- highScore = 0;
- else
- highScore = localStorage.getItem("highScore");
- var L = new loader();
- L.parseResources();
- var J = new Joc();
- setTimeout(function()
- {
- if(x == 0)
- {
- J.init(L);
- }
- }, 100);
- }
- window.onload = function()
- {
- document.getElementById("container_joc").style.display= "none";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement