Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var key = "mjs-tower-of-colors-island-edition-v1.0.0";
- function getLS() {
- if (localStorage.gameState) {
- return JSON.parse(localStorage.getItem(key));
- } else {
- return false;
- }
- }
- function setLS(input) {
- try {
- localStorage.setItem(key, JSON.stringify(input));
- refreshGame();
- } catch {
- console.warn("Unable to set localStorage!");
- }
- }
- function clearLS() {
- try {
- localStorage.removeItem(key);
- refreshGame();
- return true;
- } catch {
- return false;
- }
- }
- function refreshGame() {
- cmg_remove_padg();
- }
- //
- function setCoins(val) {
- var t = getLS();
- t.coin = val;
- setLS(t);
- }
- function setHighScore(val) {
- var t = getLS();
- t.highscore = val;
- setLS(t);
- }
- function setWildshot(val) {
- var t = getLS();
- t.wildshot = val;
- setLS(t);
- }
- function setLaserbeam(val) {
- var t = getLS();
- t.laserbeam = val;
- setLS(t);
- }
- function setAll(val) {
- setCoins(val);
- setHighScore(val);
- setWildshot(val);
- setLaserbeam(val);
- }
Add Comment
Please, Sign In to add comment