|
|
|
@ -2,7 +2,9 @@ class Card {
@@ -2,7 +2,9 @@ class Card {
|
|
|
|
|
color; |
|
|
|
|
symbol; |
|
|
|
|
points; |
|
|
|
|
facingDown = false; |
|
|
|
|
assetUrl; |
|
|
|
|
backAssetUrl; |
|
|
|
|
|
|
|
|
|
constructor(color, symbol, points, assetBaseUrl = 'img/') { |
|
|
|
|
this.color = color; |
|
|
|
@ -15,7 +17,23 @@ class Card {
@@ -15,7 +17,23 @@ class Card {
|
|
|
|
|
return assetBaseUrl + this.color + this.symbol + '.png' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cardIsAnAce() { |
|
|
|
|
isAnAce() { |
|
|
|
|
return this.symbol === 'a'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
flip() { |
|
|
|
|
this.facingDown = !this.facingDown; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isFacingDown() { |
|
|
|
|
return this.facingDown; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get assetUrl() { |
|
|
|
|
if (this.isFacingDown()) { |
|
|
|
|
return this.backAssetUrl; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this.assetUrl; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|