Code edit (12 edits merged)
Please save this source code
User prompt
Make the position pattern in the modules white
User prompt
Make the position pattern white
Code edit (8 edits merged)
Please save this source code
User prompt
Make a container called QRcode, We're not making a QR Maze Runner
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
QR Maze Runner
Initial prompt
Qr code generator
/****
* Classes
****/
var QRCode = Container.expand(function (pixelSize) {
var self = Container.call(this);
// Initialize QR code properties
self.pixelSize = pixelSize || 32;
self.modules = [];
// Create QR code pattern (simple placeholder pattern for now)
self.createPattern = function () {
// Create a simple pattern for demonstration
var size = 21; // Standard QR code size
for (var row = 0; row < size; row++) {
self.modules[row] = [];
for (var col = 0; col < size; col++) {
// Create a simple pattern
var isBlack = row % 2 === 0 && col % 2 === 0 || row < 7 && col < 7 ||
// Top-left position pattern
row < 7 && col >= size - 7 ||
// Top-right position pattern
row >= size - 7 && col < 7; // Bottom-left position pattern
// Check if this pixel is in a position pattern (corners)
var isPositionPattern = row < 7 && col < 7 ||
// Top-left
row < 7 && col >= size - 7 ||
// Top-right
row >= size - 7 && col < 7; // Bottom-left
if (isBlack) {
var tintColor = isPositionPattern ? 0xffffff : 0x000000; // White for position patterns, black for others
var pixel = self.attachAsset('QRCodePixel', {
x: col * self.pixelSize,
y: row * self.pixelSize,
scaleX: self.pixelSize,
scaleY: self.pixelSize,
tint: tintColor
});
self.modules[row][col] = pixel;
}
}
}
};
// Initialize the pattern
self.createPattern();
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xFFFFFF
});
/****
* Game Code
****/
// Create QR code container
var qrCode = new QRCode(32);
qrCode.x = (2048 - qrCode.width) / 2;
qrCode.y = (2732 - qrCode.height) / 2;
game.addChild(qrCode); ===================================================================
--- original.js
+++ change.js
@@ -37,22 +37,8 @@
self.modules[row][col] = pixel;
}
}
}
- self.attachAsset('QRCodePositionL', {
- x: 0,
- y: 0
- });
- self.attachAsset('QRCodePositionR', {
- x: self.pixelSize * 21,
- y: 0,
- anchorX: 1
- });
- self.attachAsset('QRCodePositionB', {
- x: 0,
- y: self.pixelSize * 21,
- anchorY: 1
- });
};
// Initialize the pattern
self.createPattern();
return self;