diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2019-07-15 21:02:34 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2019-07-15 21:02:34 -0400 |
commit | 278f2ff2d0888893b30b4179dd3400201af1fa1b (patch) | |
tree | 58549fba5f325ced8b91bb103f3e875eff18da7d /index.html | |
parent | a85f13d5019b5313cd2edc9e6a5441185a7b521e (diff) |
[RELEASE] Loading and saving (plus some bugfixes)
Additions:
+ Loading and saving game states now supported (from app-created save files)
+ Code taken from Kanchu (and contributors) on StackOverflow for saving files
+ 3x3 minimum area implemented for game starts
+ Bugfix for disappearing mines on local repo
Other:
~ More concise CSS
~ Probably the final version unless I find another cool feature which I feel like putting in
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -26,13 +26,17 @@ <option value="0.25">Impossible</option>
<option value="0">Custom</option>
</select>
+ <br>
+ <label>- OR -</label>
+ <br>
+ <button id="save" onclick="game.save()">Save Game</button> | <label for="fin">Choose Save File</label><input id="fin" type="file" accept=".mgs"/> <button id="load" onclick="game.loadFromFile()">Load Game</button>
</div>
<br>
<div class="game">
<h1 id="mines">0</h1><button id="circle" onclick="game.reset()"></button><h1 id="time">0</h1>
<br>
<table>
- <tbody id="gtable"><tr><td class="wt">◉</td></tr></tbody>
+ <tbody id="gtable"><tr><td class="wt">◉</td></tr></tbody>
</table>
</div>
<script>
@@ -41,13 +45,15 @@ var mIn = document.getElementById("m");
var dIn = document.getElementById("d");
- var sMines = document.getElementById("mines");
+ var sMines = document.getElementById("mines");
var sTime = document.getElementById("time");
var circle = document.getElementById("circle");
var table = document.getElementById("gtable");
+ var fileSel = document.getElementById("fin");
+
var game = new Board();
mIn.addEventListener("change", function(){
|