summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-06-17 14:29:49 +0100
committerGitHub <noreply@github.com>2024-06-17 14:29:49 +0100
commite69ae1518281a867401c4e0b518eabf1ec7b970d (patch)
tree757216b8e28b2b9ff4eec0c7930d3325692117a3
parentf7054b4739097088b7bc7159b40ce967cafee568 (diff)
download1989-dawn-of-freedom-e69ae1518281a867401c4e0b518eabf1ec7b970d.tar.gz
Update play.js
Cards now in a cards directory. Too many cards for a single folder, so cards and cards2
-rw-r--r--play.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/play.js b/play.js
index 2691439..fe2bee4 100644
--- a/play.js
+++ b/play.js
@@ -33,6 +33,7 @@ let czechHeld=0
let hungaryHeld=0
let romaniaHeld=0
let bulgariaHeld=0
+let presidentialVisit=0
const countryNames= [
@@ -147,7 +148,7 @@ function createMap() {
const handLimit = 8;
-const comHandLimit = 8; //Will be needed for Presidential Visit
+const comHandLimit = 8 + presidentialVisit;
const hand =[];
const discard =[];
@@ -173,12 +174,22 @@ drawCards(deck, handLimit);
function displayHand(hand) {
const handDiv = document.getElementById('hand');
hand.forEach(card => {
- const img = document.createElement('img')
- img.src = `images/e${card}.gif`
- img.className='handCard'
- img.alt = `Card ${card}`
- img.addEventListener('click', playCard)
- handDiv.appendChild(img)
+ if (card < 100) {
+ const img = document.createElement('img')
+ img.src = `cards/e${card}.gif`
+ img.className='handCard'
+ img.alt = `Card ${card}`
+ img.addEventListener('click', playCard)
+ handDiv.appendChild(img)
+ }
+ else {
+ const img = document.createElement('img')
+ img.src = `cards2/e${card}.gif`
+ img.className='handCard'
+ img.alt = `Card ${card}`
+ img.addEventListener('click', playCard)
+ handDiv.appendChild(img)
+ }
})
}