User prompt
Fix Bug: 'TypeError: LK.getSetting is not a function' in this line: 'setting3.isSelected = LK.getSetting('setting3');' Line Number: 123
User prompt
Fix Bug: 'TypeError: LK.getSetting is not a function' in this line: 'setting2.isSelected = LK.getSetting('setting2');' Line Number: 119
User prompt
Fix Bug: 'TypeError: LK.getSetting is not a function' in this line: 'setting1.isSelected = LK.getSetting('setting1');' Line Number: 115
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setting1')' in this line: 'if (game.settings['setting1']) {' Line Number: 103
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setting1')' in this line: 'if (game.settings['setting1']) {' Line Number: 103
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setting1')' in this line: 'if (game.settings['setting1']) {' Line Number: 103
User prompt
Fix Bug: 'TypeError: LK.getSetting is not a function' in this line: 'if (LK.getSetting('setting1')) {' Line Number: 103
User prompt
Fix Bug: 'TypeError: game.getSetting is not a function' in this line: 'if (game.getSetting('setting1')) {' Line Number: 103
User prompt
Fix Bug: 'TypeError: LK.getSetting is not a function' in this line: 'if (LK.getSetting('setting1')) {' Line Number: 103
User prompt
every time the settings menu is opened, send a debug message that lists the current settings that are activated
User prompt
when the settings cog is pressed check wich setting is alreadt activated
User prompt
add a condition that saves if a setting is activated or not
User prompt
add a condition that saves if a setting is activated or not
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setItem')' in this line: 'localStorage.setItem('setting1', setting1.isSelected);' Line Number: 91
User prompt
Fix Bug: 'TypeError: LK.storeSetting is not a function' in this line: 'LK.storeSetting('setting1', setting1.isSelected);' Line Number: 91
User prompt
Fix Bug: 'TypeError: LK.retrieveSetting is not a function' in this line: 'setting3.isSelected = LK.retrieveSetting('setting3');' Line Number: 115
User prompt
Fix Bug: 'TypeError: LK.retrieveSetting is not a function' in this line: 'setting2.isSelected = LK.retrieveSetting('setting2');' Line Number: 111
User prompt
Fix Bug: 'TypeError: LK.retrieveSetting is not a function' in this line: 'setting1.isSelected = LK.retrieveSetting('setting1');' Line Number: 107
User prompt
remember the state of the setting when the settings panel is despawned
User prompt
remove all mention and dependencie of the car color
Code edit (1 edits merged)
Please save this source code
User prompt
the individual settings should also despawn when the setting cog is pressed again
User prompt
the settings should appear on top of the background, with the use of z-ordering
User prompt
recode the settings so the carcolor isnt needed for it to work
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -18,27 +18,27 @@
});
self.activateSetting1 = function () {
console.log('Setting 1' + (self.isSelected ? ' was activated' : ' was deactivated'));
if (self.isSelected) {
- LK.setSetting('setting1', true);
+ setGameSetting('setting1', true);
} else {
- LK.setSetting('setting1', false);
+ setGameSetting('setting1', false);
}
};
self.activateSetting2 = function () {
console.log('Setting 2' + (self.isSelected ? ' was activated' : ' was deactivated'));
if (self.isSelected) {
- LK.setSetting('setting2', true);
+ setGameSetting('setting2', true);
} else {
- LK.setSetting('setting2', false);
+ setGameSetting('setting2', false);
}
};
self.activateSetting3 = function () {
console.log('Setting 3' + (self.isSelected ? ' was activated' : ' was deactivated'));
if (self.isSelected) {
- LK.setSetting('setting3', true);
+ setGameSetting('setting3', true);
} else {
- LK.setSetting('setting3', false);
+ setGameSetting('setting3', false);
}
};
});
/*
@@ -97,21 +97,8 @@
console.log('Settings cogwheel tapped');
settingsBackground.visible = !settingsBackground.visible;
settingsBackground.x = 2048 / 2;
settingsBackground.y = 2732 / 2;
- if (settingsBackground.visible) {
- var activeSettings = [];
- if (game.settings && game.settings['setting1']) {
- activeSettings.push('Setting 1');
- }
- if (game.settings && game.settings['setting2']) {
- activeSettings.push('Setting 2');
- }
- if (game.settings && game.settings['setting3']) {
- activeSettings.push('Setting 3');
- }
- console.debug('Current active settings: ' + activeSettings.join(', '));
- }
if (!settingsBackground.visible) {
if (setting1) {
game.removeChild(setting1);
}
@@ -124,9 +111,9 @@
} else {
setting1 = game.addChild(new SettingOption('setting1', 'Setting 1'));
setting1.x = settingsBackground.x;
setting1.y = settingsBackground.y - 300;
- setting1.isSelected = LK.getSetting('setting1');
+ setting1.isSelected = getGameSetting('setting1');
setting2 = game.addChild(new SettingOption('setting2', 'Setting 2'));
setting2.x = settingsBackground.x;
setting2.y = settingsBackground.y - 150;
setting2.isSelected = LK.getSetting('setting2');
@@ -145,25 +132,27 @@
* Game initialization: This is where we create the game.
* We set the background color to black.
*/
var game = new LK.Game({
- backgroundColor: 0x000000,
- settings: {
- 'setting1': false,
- 'setting2': false,
- 'setting3': false
- }
+ backgroundColor: 0x000000
});
/****
* Game Code
****/
/*
-* Set the background color to white.
+* Game code: This is where we set up the game.
*/
/*
-* Game code: This is where we set up the game.
+* Set the background color to white.
*/
+var gameSettings = {};
+function getGameSetting(setting) {
+ return gameSettings[setting];
+}
+function setGameSetting(setting, value) {
+ gameSettings[setting] = value;
+}
game.setBackgroundColor(0xFFFFFF);
/*
* Create the settings cogwheels and add it to the game.