Add keyboard shortcut for restarting the level
This commit is contained in:
parent
8adb630862
commit
ec67fc7bbb
@ -118,7 +118,7 @@
|
|||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="play-controls">
|
<div class="play-controls">
|
||||||
<button class="control-pause" type="button">Pause <span class="keyhint">(p)</span></button>
|
<button class="control-pause" type="button">Pause <span class="keyhint">(p)</span></button>
|
||||||
<button class="control-restart" type="button">Restart</button>
|
<button class="control-restart" type="button">Restart <span class="keyhint">(r)</span></button>
|
||||||
<button class="control-undo" type="button">Undo</button>
|
<button class="control-undo" type="button">Undo</button>
|
||||||
<button class="control-rewind" type="button">Rewind <span class="keyhint">(z)</span></button>
|
<button class="control-rewind" type="button">Rewind <span class="keyhint">(z)</span></button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -444,6 +444,13 @@ class Player extends PrimaryView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ev.key === 'r') {
|
||||||
|
if (this.state === 'playing') {
|
||||||
|
this.restart_level();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.key_mapping[ev.key]) {
|
if (this.key_mapping[ev.key]) {
|
||||||
this.current_keys.add(ev.key);
|
this.current_keys.add(ev.key);
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user