besser
This commit is contained in:
		@@ -5,26 +5,50 @@ const rechenzeichen = ['+','-','*',':'];
 | 
				
			|||||||
const rechnung1Text = document.querySelector("#rechnung1Text");
 | 
					const rechnung1Text = document.querySelector("#rechnung1Text");
 | 
				
			||||||
const rechnung2Text = document.querySelector("#rechnung2Text");
 | 
					const rechnung2Text = document.querySelector("#rechnung2Text");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const maxZahl = 100;
 | 
				
			||||||
 | 
					const maxMal = 11;
 | 
				
			||||||
 | 
					const maxDurch = 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//rechnung2Text.innerText = "hallo";
 | 
					//rechnung2Text.innerText = "hallo";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rechnungen.style.top = rechnungenTop + "px";
 | 
					rechnungen.style.top = rechnungenTop + "px";
 | 
				
			||||||
 | 
					rechnungenSpawn(maxZahl,maxMal,maxDurch);
 | 
				
			||||||
function rechnungMoven(speed){
 | 
					function rechnungMoven(speed){
 | 
				
			||||||
    let nextTop = rechnungenTop + 10 * speed;
 | 
					    let nextTop = rechnungenTop + 10 * speed;
 | 
				
			||||||
    rechnungen.style.top = nextTop + "px";
 | 
					    rechnungen.style.top = nextTop + "px";
 | 
				
			||||||
    if(nextTop > 800){
 | 
					    if(nextTop > 800){
 | 
				
			||||||
        rechnungen.style.top = "1px";
 | 
					        rechnungen.style.top = "1px";
 | 
				
			||||||
        rechnungenTop = 1;
 | 
					        rechnungenTop = 1;
 | 
				
			||||||
        rechnungenSpawn(100);
 | 
					        rechnungenSpawn(maxZahl,maxMal,maxDurch);
 | 
				
			||||||
    }else{
 | 
					    }else{
 | 
				
			||||||
        rechnungenTop = nextTop;
 | 
					        rechnungenTop = nextTop;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function rechnungenSpawn(maxzahl){
 | 
					function rechnungenSpawn(maxzahl,maxMal,maxDurch){
 | 
				
			||||||
    let index = Math.floor(Math.random()*rechenzeichen.length);
 | 
					    let index = Math.floor(Math.random()*rechenzeichen.length);
 | 
				
			||||||
    let randomZahl = Math.floor(Math.random()*maxzahl);
 | 
					    let randomZahl = 0;
 | 
				
			||||||
 | 
					    if(rechenzeichen[index] == '+' || rechenzeichen[index] == '-'){
 | 
				
			||||||
 | 
					        randomZahl = Math.floor(Math.random()*maxzahl);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if(rechenzeichen[index] == '*'){
 | 
				
			||||||
 | 
					        randomZahl = Math.floor(Math.random()*maxMal);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if(rechenzeichen[index] == ':'){
 | 
				
			||||||
 | 
					        randomZahl = Math.floor(Math.random()*maxDurch) + 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    rechnung1Text.innerText = rechenzeichen[index] + randomZahl.toString();
 | 
					    rechnung1Text.innerText = rechenzeichen[index] + randomZahl.toString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    index = Math.floor(Math.random()*rechenzeichen.length);
 | 
					    index = Math.floor(Math.random()*rechenzeichen.length);
 | 
				
			||||||
    randomZahl = Math.floor(Math.random()*maxzahl);
 | 
					    if(rechenzeichen[index] == '+' || rechenzeichen[index] == '-'){
 | 
				
			||||||
 | 
					        randomZahl = Math.floor(Math.random()*maxzahl);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if(rechenzeichen[index] == '*'){
 | 
				
			||||||
 | 
					        randomZahl = Math.floor(Math.random()*maxMal);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if(rechenzeichen[index] == ':'){
 | 
				
			||||||
 | 
					        randomZahl = Math.floor(Math.random()*maxDurch) + 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    rechnung2Text.innerText = rechenzeichen[index] + randomZahl.toString();
 | 
					    rechnung2Text.innerText = rechenzeichen[index] + randomZahl.toString();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
setInterval(()=>{
 | 
					setInterval(()=>{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user