User prompt
remove this id's/assets Id colorButtongreen Id colorButtonyellow Id colorButtonred Id colorButtonblu
User prompt
zorg er voor dat alle collor buttons worden verwijderd
User prompt
maak een nieuwe kleur aan genaamd rood en maak er een button voor
User prompt
remove al colors
User prompt
Fix Bug: 'Timeout.tick error: pencil is not defined' in this line: 'var drawingGraphics = self.createAsset('drawing' + pencil.color, 'Drawing by pencil', .5, .5);' Line Number: 20
User prompt
make id colorButtongreen the color draw the color Green #319400
User prompt
ik wil 3 kleuren Rood, blauw, groen kan je die nu fixen om te krijgen
User prompt
Fix Bug: 'Timeout.tick error: pencil is not defined' in this line: 'var drawingGraphics = self.createAsset('drawing' + pencil.color, 'Drawing by pencil', .5, .5);' Line Number: 20
User prompt
Fix Bug: 'ReferenceError: pencil is not defined' in this line: 'pencil.color = self.color;' Line Number: 6
Initial prompt
Create 3 buttons at the bottom of the screen that indicate and also work which color you can choose from (red, blue, yellow)
var ColorButton = Container.expand(function (color) { var self = Container.call(this); var buttonGraphics = self.createAsset('colorButton' + color, 'Color Button ' + color, .5, .5); if (color === 'blu') buttonGraphics.destroy(); if (color === 'red') buttonGraphics.destroy(); if (color === 'yellow') buttonGraphics.destroy(); if (color === 'green') buttonGraphics.destroy(); self.color = color; }); var Pencil = Container.expand(function () { var self = Container.call(this); var pencilGraphics = self.createAsset('pencil', 'Pencil for drawing', .5, .5); self.speed = 5; self.move = function () { self.x += self.speed; }; }); var Drawing = Container.expand(function (color) { var self = Container.call(this); var drawingGraphics = self.createAsset('drawing', 'Drawing by pencil', .5, .5); }); var Game = Container.expand(function () { var self = Container.call(this); var pencil = self.addChild(new Pencil()); pencil.x = 1024; pencil.y = 1366; var drawings = []; var isDrawing = false; var resetButton = self.createAsset('resetButton', 'Reset Button', 0, 0); resetButton.x = 0; resetButton.y = 0; LK.gui.topLeft.addChild(resetButton); resetButton.on('down', function () { LK.showGameOver(); }); var timer = LK.setInterval(function () { if (isDrawing) { var newDrawing = new Drawing(); newDrawing.x = pencil.x; newDrawing.y = pencil.y; drawings.push(newDrawing); self.addChild(newDrawing); } }, 1000 / 60); pencil.on('down', function (obj) { isDrawing = true; }); stage.on('up', function (obj) { isDrawing = false; }); stage.on('move', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); pencil.x = pos.x; pencil.y = pos.y; }); LK.on('tick', function () { pencil.move(); if (pencil.x < 0 || pencil.x > 2048 || pencil.y < 0 || pencil.y > 2732) { LK.clearInterval(timer); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,11 @@
var ColorButton = Container.expand(function (color) {
var self = Container.call(this);
var buttonGraphics = self.createAsset('colorButton' + color, 'Color Button ' + color, .5, .5);
+ if (color === 'blu') buttonGraphics.destroy();
+ if (color === 'red') buttonGraphics.destroy();
+ if (color === 'yellow') buttonGraphics.destroy();
+ if (color === 'green') buttonGraphics.destroy();
self.color = color;
});
var Pencil = Container.expand(function () {
var self = Container.call(this);