Saving and loading
This commit is contained in:
4
src/engine/commands/load.js
Normal file
4
src/engine/commands/load.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export default function LoadCommand(args, context) {
|
||||
context.print(`Loading game...`);
|
||||
context.load();
|
||||
}
|
4
src/engine/commands/save.js
Normal file
4
src/engine/commands/save.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export default function SaveCommand(args, context) {
|
||||
context.print(`Saving game...`);
|
||||
context.save();
|
||||
}
|
19
src/engine/commands/volume.js
Normal file
19
src/engine/commands/volume.js
Normal file
@@ -0,0 +1,19 @@
|
||||
export default function VolumeCommand(args, context) {
|
||||
if (args.length < 3) {
|
||||
return context.print(`Usage: volume <music/sfx/ambience> <0-100>`);
|
||||
}
|
||||
const value = parseInt(args[2]);
|
||||
if (value > 100 || value < 1) {
|
||||
return context.print(`No higher than 100 and no less than 1.`);
|
||||
}
|
||||
if (args[1] == "sfx") {
|
||||
context.output.sound.setSFXVolume(value/100);
|
||||
} else if (args[1] == "music") {
|
||||
context.output.sound.setMusicVolume(value/100);
|
||||
} else if (args[1] == "ambience") {
|
||||
context.output.sound.setAmbienceVolume(value/100);
|
||||
} else {
|
||||
return context.print(`Invalid channel. Either ambience, sfx or music is allowed.`);
|
||||
}
|
||||
context.print(`${args[1]} volume set to ${value}%`)
|
||||
}
|
Reference in New Issue
Block a user