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
@@ -64,54 +64,51 @@
* The anchor point is set to the center of the graphics.
*/
var cogwheelGraphics = self.createAsset('cogwheels', 'Settings Cogwheel', 0.5, 0.5);
/*
+ * This flag indicates whether the car color option is currently displayed.
+ */
+ var carColorDisplayed = false;
+ /*
+ * This will hold the CarColor instance when it is created.
+ */
+ var carColor;
+ /*
* Create the settings background.
*/
var settingsBackground = new SettingsBackground();
/*
* When the cogwheels are tapped, we toggle the visibility of the settings menu.
*/
var setting1, setting2, setting3;
cogwheelGraphics.on('down', function () {
- game.addChild(settingsBackground, 10);
+ game.addChild(settingsBackground);
console.log('Settings cogwheel tapped');
settingsBackground.visible = !settingsBackground.visible;
settingsBackground.x = 2048 / 2;
settingsBackground.y = 2732 / 2;
- setting1 = game.addChild(new SettingOption('setting1', 'Setting 1'), 11);
- setting1.x = settingsBackground.x;
- setting1.y = settingsBackground.y - 300;
- setting2 = game.addChild(new SettingOption('setting2', 'Setting 2'), 11);
- setting2.x = settingsBackground.x;
- setting2.y = settingsBackground.y - 150;
- setting3 = game.addChild(new SettingOption('setting3', 'Setting 3'), 11);
- setting3.x = settingsBackground.x;
- setting3.y = settingsBackground.y;
- if (!settingsBackground.visible) {
- setting1 = game.addChild(new SettingOption('setting1', 'Setting 1'), 11);
+ if (!carColorDisplayed) {
+ setting1 = game.addChild(new SettingOption('setting1', 'Setting 1'));
setting1.x = settingsBackground.x;
setting1.y = settingsBackground.y - 300;
- setting2 = game.addChild(new SettingOption('setting2', 'Setting 2'), 11);
+ setting2 = game.addChild(new SettingOption('setting2', 'Setting 2'));
setting2.x = settingsBackground.x;
setting2.y = settingsBackground.y - 150;
- setting3 = game.addChild(new SettingOption('setting3', 'Setting 3'), 11);
+ setting3 = game.addChild(new SettingOption('setting3', 'Setting 3'));
setting3.x = settingsBackground.x;
setting3.y = settingsBackground.y;
} else {
if (setting1) {
game.removeChild(setting1);
- setting1 = null;
}
if (setting2) {
game.removeChild(setting2);
- setting2 = null;
}
if (setting3) {
game.removeChild(setting3);
- setting3 = null;
}
}
+ carColorDisplayed = !carColorDisplayed;
});
});
/****
@@ -121,15 +118,23 @@
* Game initialization: This is where we create the game.
* We set the background color to black.
*/
var game = new LK.Game({
- backgroundColor: 0xFFFFFF
+ backgroundColor: 0x000000
});
/****
* Game Code
****/
/*
+* Game code: This is where we set up the game.
+*/
+/*
+* Set the background color to white.
+*/
+game.setBackgroundColor(0xFFFFFF);
+
+/*
* Create the settings cogwheels and add it to the game.
* We position it at the top right corner of the screen.
*/
var cogwheels = game.addChild(new Cogwheels());