Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limiting Hints #30 #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions decks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const decks = [
name: "Animated Movies",
author: "N-Shar-ma",
instructions:
"The emoji/s on each card are a clue for an animated movie. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the movie name in easy mode, and a character/place in the movie in the challenging mode. You can make a maximum of 3 wrong matches.",
"The emoji/s on each card are a clue for an animated movie. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the movie name in easy mode, and a character/place in the movie in the challenging mode. You can make a maximum of 3 wrong matches and you have total 3 hints.",
cards: [
{
name: "Frozen",
Expand Down Expand Up @@ -211,7 +211,7 @@ const decks = [
name: "Coding Languages",
author: "N-Shar-ma",
instructions:
"The emoji/s on each card are a clue for a programming language. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the coding language name in easy mode, and a couple lines of code in that language in the challenging mode. You can make a maximum of 3 wrong matches.",
"The emoji/s on each card are a clue for a programming language. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the coding language name in easy mode, and a couple lines of code in that language in the challenging mode. You can make a maximum of 3 wrong matches and you have total 3 hints.",
cards: [
{
name: "Java",
Expand Down Expand Up @@ -328,7 +328,7 @@ echo $message;`,
{
name: "Freedom Fighters",
author: "AlphaGaurav7",
instructions: "The emoji/s on each card are a clue for a Freedom Fighter. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the nickname in easy mode, and a famous quote in the challenging mode. You can make a maximum of 3 wrong matches.",
instructions: "The emoji/s on each card are a clue for a Freedom Fighter. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the nickname in easy mode, and a famous quote in the challenging mode. You can make a maximum of 3 wrong matches and you have total 3 hints.",
cards: [
{
name: "Mahatma Gandhi",
Expand Down Expand Up @@ -435,7 +435,7 @@ echo $message;`,
{
name: "States and UT",
author: "KarthikS373",
instructions: "The emoji/s on each card are clues for a state of UT. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the States and UTs name in easy mode, and a fact about the State / UTin the challenging mode. You can make a maximum of 3 wrong matches.",
instructions: "The emoji/s on each card are clues for a state of UT. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the States and UTs name in easy mode, and a fact about the State / UTin the challenging mode. You can make a maximum of 3 wrong matches and you have total 3 hints.",
cards: [
{
name: "Andaman and Nicobar",
Expand Down Expand Up @@ -534,7 +534,7 @@ echo $message;`,
{
name: "Fruits",
author: "divya-nshi",
instructions: "The emoji/s on each card are a clue for a fruit. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the fruit name in easy mode, and a fact of the food in the challenging mode. You can make a maximum of 3 wrong matches.",
instructions: "The emoji/s on each card are a clue for a fruit. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the fruit name in easy mode, and a fact of the food in the challenging mode. You can make a maximum of 3 wrong matches and you have total 3 hints and you have total 3 hints.",
cards:[
{
name: "Orange",
Expand Down Expand Up @@ -632,7 +632,7 @@ echo $message;`,
name: "Rock Bands",
author: "SameepAher",
instructions:
"The emoji/s on each card are a clue for an English Rock Band (Mostly old). You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the rock band name in easy mode, and name of some band members in the challenging mode. You can make a maximum of 3 wrong matches.",
"The emoji/s on each card are a clue for an English Rock Band (Mostly old). You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the rock band name in easy mode, and name of some band members in the challenging mode. You can make a maximum of 3 wrong matches and you have total 3 hints.",
cards: [
{
name: "Guns N' Roses",
Expand Down Expand Up @@ -730,7 +730,7 @@ echo $message;`,
{
name: "Marvel Heroes",
author: "Ilikepizza2",
instructions: "The emoji/s on each card are a clue for a hero from the Marvel universe. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the superhero's alias in easy mode, and their real name in the challenging mode. You can make a maximum of 3 wrong matches.",
instructions: "The emoji/s on each card are a clue for a hero from the Marvel universe. You can flip (click) the card to see an additional hint. Drag and drop a card onto the matching text clue on the right, which will be the superhero's alias in easy mode, and their real name in the challenging mode. You can make a maximum of 3 wrong matches and you have total 3 hints.",
cards: [
{
name: "Ant Man",
Expand Down
8 changes: 7 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ <h1 id="title-text">Emoji Card Game</h1>
</aside>
<main id="game-area">
<div id="name-shower">The card depicted: <span></span></div>
<div id="score-display">Score: <span id="score">0</span></div>
<div id="score">
<div id="score-display">Score:
<span id="score">0</span></div>
</div> -->
</div>
</div>
<div class="card-container" id="source">
</div>
<div class="card-container" id="destination">
Expand All @@ -49,6 +54,7 @@ <h1 id="title-text">Emoji Card Game</h1>
</div>
</div>
<div id="hints-display">Hints seen: <span id="hint">0</span></div>
<div id="hints-left">Hints left: <span id="hints">3</span></div>
<div id="deck-author-display">Deck Created by: <a id="author" href="#" target=blank_></a></div>
</main>
<template id="cardTemplate">
Expand Down
16 changes: 14 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ const source = document.getElementById("source");
const destination = document.getElementById("destination");
const score = document.getElementById("score");
const hint = document.getElementById("hint");
const hintLeft = document.getElementById("hints")
const maxCardsPlayable = 6;
const maxCardsWrong = 3;
let deckLength;
let matcher;
let showName;
let scoreCount = 0;
let hintCount = 0;
let hints=3;

chooseDeck()

Expand Down Expand Up @@ -128,16 +130,21 @@ function setUpCardDragEventListeners(draggable)
function flip()
{
const cardObject = getCorrespondingCardObject(this.dataset.name);
if(cardObject.seenHint || wrongCardObjectsDeck.includes(cardObject))
if(hints==0 && !cardObject.seenHint){
alert("Hints are over");
}
else if(cardObject.seenHint || wrongCardObjectsDeck.includes(cardObject))
{
this.classList.toggle("flipped");
}
else if(!cardObject.seenHint && confirm("Are you sure you want to see a hint?"))
else if(!cardObject.seenHint && confirm("Are you sure you want to see a hint?") && hints>0)
{
updateHintElement(++hintCount);
updateHintleft(--hints)
cardObject.seenHint = true;
this.classList.toggle("flipped");
}

}

function getCorrespondingCardObject(name)
Expand Down Expand Up @@ -231,6 +238,11 @@ function updateScoreElement(scoreCount)
score.innerText = scoreCount;
}

function updateHintleft(hintleft)
{
hintLeft.innerText = hints;
}

function updateHintElement(hintCount)
{
hint.innerText = hintCount;
Expand Down
9 changes: 8 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ main{
font-style: italic;
}

#score-display, #hints-display, #deck-author-display {



#score-display, #hints-display,#hints-left, #deck-author-display {
position: absolute;
left: 75vw;
transform: translateX(-50%) translateY(-50%);
Expand Down Expand Up @@ -150,6 +153,10 @@ main{
}

#hints-display{
top: 80vh;
}

#hints-left{
top: 85vh;
}

Expand Down