Skip to content
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
30 changes: 30 additions & 0 deletions globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ----- GLOBAL VARIABLES -----------------------
const boardSize = 4;
const board = [];

let deck;
let firstCard = null;
let firstCardElement;

// For gameplay
let canClick = false;

// For stopwatch
let milliseconds = 0;
const delayInMilliseconds = 100; // 0.1 second
const maxMilliseconds = 180000; // 3 minutes (1 min = 60 000ms)
let stopwatchStarted = false;
let stopwatchRef;

const stopwatch = document.createElement('div');
const startBtn = document.createElement('button');
const stopBtn = document.createElement('button');
const resetBtn = document.createElement('button');

// For game information
const stopwatchContainer = document.createElement('div');
const gameRulesDiv = document.createElement('div');
const gameInfoContainer = document.createElement('div');
const gameInfo = document.createElement('div');
let timeoutMsgMatch;
let timeoutMsgNoMatch;
21 changes: 12 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Timer</title>
<link rel="stylesheet" href="styles.css" />
</head>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="styles.css" />
<title>Liz's Card Match Game (Stopwatch version)</title>
</head>

<body>
<h1 id="header">Timer!</h1>
<!-- Import program logic -->
<script src="script.js"></script>
</body>
<body>
<h1 id="header">Liz's Card Match Game</h1>
<h2>(Stopwatch version)</h2>
<!-- Import program logic -->
<script src="globals.js"></script>
<script src="script.js"></script>
</body>
</html>
Loading