Skip to content

Commit

Permalink
add function for genearting trump
Browse files Browse the repository at this point in the history
  • Loading branch information
michivonah committed Jan 15, 2023
1 parent 68f6f57 commit 6735445
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function startGame(){
//window.scroll(0, window.innerHeight);
shuffleCards();
distributeCards(player0);
generateTrump();
}

function shuffleCards(){
Expand Down Expand Up @@ -250,6 +251,10 @@ function distributeCards(cards){
}

function generateTrump(){
var random = Math.floor(Math.random() * 3);
trump = random;
trump = Math.floor(Math.random() * 3);
var trumpIcon = document.getElementById("currentTrump");
if(trump == 0) trumpIcon.src = "assets/cards/eichel.svg";
else if(trump == 0) trumpIcon.src = "assets/cards/rose.svg";
else if(trump == 0) trumpIcon.src = "assets/cards/schelle.svg";
else trumpIcon.src = "assets/cards/schilte.svg";
}

0 comments on commit 6735445

Please sign in to comment.