Skip to content

Commit 19a5780

Browse files
authored
Add shake screen to explosion. (#6)
1 parent f5e9dc0 commit 19a5780

File tree

4 files changed

+40
-17
lines changed

4 files changed

+40
-17
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# SMS - SweeperForce Changelog
22

3+
## v1.0.2
4+
5+
### Added
6+
- Added animated shake to lost game explosion (#2)
7+
8+
### Fixed
9+
- Fixed play/pause button not toggling (#1)
10+
- Fixed clock not animating (#1)
11+
- Fixed pause screen not going away when resetting game.
12+
313
## v1.0.1
414

515
### Added

force-app/main/default/lwc/smsSweeperForce/smsSweeperForce.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
overflow: visible;
6262
}
6363

64+
.sms-lost{
65+
animation: shake 0.15s 5;
66+
}
67+
6468
.sms-winner::after,
6569
.sms-lost::after,
6670
.sms-paused::before,
@@ -175,7 +179,7 @@
175179
animation-iteration-count: infinite;
176180
}
177181

178-
.sms-grid.reset .sms-cell_top {
182+
.sms-grid.sms-reset .sms-cell_top {
179183
--sms-radiate-delay: calc(var(--sms-radiate) * 30ms);
180184
animation-name: reset;
181185
animation-duration: 350ms;
@@ -290,6 +294,14 @@ svg {
290294
}
291295
}
292296

297+
@keyframes shake {
298+
0% { transform: translateX(0) }
299+
25% { transform: translateX(0.25rem) }
300+
50% { transform: translateX(-0.25rem) }
301+
75% { transform: translateX(0.25rem) }
302+
100% { transform: translateX(0) }
303+
}
304+
293305
@keyframes explode {
294306
0% {
295307
border-color: var(--sms-border-color);

force-app/main/default/lwc/smsSweeperForce/smsSweeperForce.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
* https://github.com/megasmack/SweeperForce
44
*/
55

6-
/**
7-
* @typedef {import("./typedefs").ForceCell} ForceCell
8-
*/
6+
/** @typedef {import("./typedefs").ForceCell} ForceCell */
97

108
import { LightningElement } from "lwc";
119
import SmsSweeperForceModal from "c/smsSweeperForceModal";
@@ -142,11 +140,12 @@ export default class SmsSweeperForce extends LightningElement {
142140
const timeout = this.height * 100;
143141
this.refs.smsGrid.classList.remove("sms-winner");
144142
this.refs.smsGrid.classList.remove("sms-lost");
145-
this.refs.smsGrid.classList.add("reset");
143+
this.refs.smsGrid.classList.remove("sms-paused");
144+
this.refs.smsGrid.classList.add("sms-reset");
146145
// eslint-disable-next-line @lwc/lwc/no-async-operation
147146
setTimeout(() => {
148147
// Remove on animation finish
149-
this.refs.smsGrid.classList.remove("reset");
148+
this.refs.smsGrid.classList.remove("sms-reset");
150149
}, timeout);
151150
}
152151
}

force-app/main/default/lwc/smsSweeperForceModal/smsSweeperForceModal.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ <h2 class="slds-m-bottom_small slds-text-heading_medium">
3939
How to Play
4040
</h2>
4141
<p class="slds-m-bottom_small">
42-
<b>Clear the mines!</b> Expose squares one at a time by clicking on them.
43-
If the square is clear, you'll get to see how many of its neighbors have mines in them (0 through
44-
8). However, if the square has a mine in it, all the mines will explode.
42+
<b>Clear the mines!</b> Expose squares one at a time by clicking on them. If the square is clear,
43+
you'll get to see how many of its neighbors have mines in them (0 through 8). However, if the square
44+
has a mine in it, all the mines will explode.
4545
</p>
4646
<p class="slds-m-bottom_small">
47-
<em>Right-click</em> or <em>Long-Press</em> on a square to flag it as a suspected mine. Do it again to
48-
mark it as questionable, and again to clear the mark. When you've exposed all the vacant squares,
47+
<em>Right-click</em> or <em>Long-Press</em> on a square to flag it as a suspected mine. Do it again
48+
to mark it as questionable, and again to clear the mark. When you've exposed all the vacant squares,
4949
you win. If a mine explodes, you lose. Click on the refresh button to start a new game.
5050
</p>
5151
<p class="slds-m-bottom_small">
52-
The left-hand counter shows the number of mines less the number of
53-
squares that you've flagged (correctly or not).
52+
The left-hand counter shows the number of mines less the number of squares that you've flagged
53+
(correctly or not).
5454
</p>
5555

5656
<h2 class="slds-m-top_medium slds-text-heading_medium">
@@ -64,19 +64,21 @@ <h2 class="slds-m-top_medium slds-text-heading_medium">
6464
</p>
6565
<p class="slds-m-bottom_x-small slds-text-body_small">
6666
See a problem? Help out by <a href="https://github.com/megasmack/SweeperForce/issues"
67-
target="_blank">logging a bug on <span>GitHub <lightning-icon icon-name="utility:new_window"
68-
size="xx-small" class="slds-current-color"></lightning-icon></span></a>.
67+
target="_blank">logging a bug on <span>GitHub <lightning-icon
68+
icon-name="utility:new_window"
69+
size="xx-small" class="slds-current-color"></lightning-icon></span></a>.
6970
</p>
7071
<p class="slds-m-bottom_xxx-small slds-text-body_small">
7172
<a href="https://github.com/megasmack/SweeperForce" target="_blank">
7273
<span>
7374
GitHub Repo
74-
<lightning-icon icon-name="utility:new_window" size="xx-small" class="slds-current-color"></lightning-icon>
75+
<lightning-icon icon-name="utility:new_window" size="xx-small"
76+
class="slds-current-color"></lightning-icon>
7577
</span>
7678
</a>
7779
</p>
7880
<p class="slds-text-color_weak slds-text-body_small">
79-
Version: 1.0.1
81+
Version: 1.0.2
8082
</p>
8183
</div>
8284
</div>

0 commit comments

Comments
 (0)