sei-ec-remote / project-1-issues

Open new issues here
1 stars 2 forks source link

Card Library #193

Closed Jlarranaga closed 11 months ago

Jlarranaga commented 11 months ago

What's the problem you're trying to solve?

Trying to understand where 'Face' comes from and how to display the back of a card.

Post any code you think might be relevant (one fenced block per file)

'Its the entire card class library I am looking at plus my code and resource code. 

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

What is your best guess as to the source of the problem?

What things have you already tried to solve the problem?

Paste a link to your repository here

https://github.com/Jlarranaga/Project1-WAR

timmshinbone commented 11 months ago

Did you take a look at this repo?

Jlarranaga commented 11 months ago

Yes, I think I got it. I'll let you know if I can't get it. Thank you Timm!

Jlarranaga commented 11 months ago

Ok, i got the back of the card to show but now I cant get the front of the card to show properly in a different funciton. image

Jlarranaga commented 11 months ago

`function duel(){ //TODO will handle button event and if two ranks are equal //TODO ...then call war function and winner function let pCardHtml = '' let cCardHtml = ''

const randPlayerIdx = Math.floor(Math.random() * pCards.length);
const randCompIdx = Math.floor(Math.random() * cCards.length);

const playerCard = pCards[randPlayerIdx]
const compCard = cCards[randCompIdx]

console.log(randPlayerIdx)
console.log(randCompIdx)

pCardHtml = `<div class="card ${playerCard}"></div>`
cCardHtml = `<div class="card ${compCard}"></div>`

console.log(playerCard)
console.log(compCard)

battlePlayerCard.innerHTML = pCardHtml
battleComputerCard.innerHTML = cCardHtml

//TODO return winner of the duel
//return duelWinner

}`

timmshinbone commented 11 months ago

Hmm, let's take a look in a 1:1, I'll slack ya

Jlarranaga commented 11 months ago

` let pCardHtml = '' let cCardHtml = ''

const randPlayerIdx = Math.floor(Math.random() * pCards.length); //may need to +1 for 26 cards
const randCompIdx = Math.floor(Math.random() * cCards.length);

const pCard = pCards[randPlayerIdx]
const cCard = cCards[randCompIdx]

battlePCard = pCard.face
battleCCard = cCard.face

pCardHtml = `<div class="card ${battlePCard}"></div>`
cCardHtml = `<div class="card ${battleCCard}"></div>`

battlePlayerCard.innerHTML = pCardHtml
battleComputerCard.innerHTML = cCardHtml`