/**** * Classes ****/ // Cat class var Cat = Container.expand(function () { var self = Container.call(this); var catGraphics = self.attachAsset('cat', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Cat update logic here }; self.checkRatCaught = function () { if (self.intersects(rat)) { LK.showGameOver(); } }; }); // PaintBucket class var PaintBucket = Container.expand(function (color) { var self = Container.call(this); var bucketGraphics = self.attachAsset('paintBucket', { anchorX: 0.5, anchorY: 0.5 }); self.color = color; bucketGraphics.tint = color; self.on('down', function () { rat.changeColor(self.color); }); }); // Assets will be automatically created based on usage in the code. // Rat class var Rat = Container.expand(function () { var self = Container.call(this); var ratGraphics = self.attachAsset('rat', { anchorX: 0.5, anchorY: 0.5 }); self.color = 0xffffff; // Default color white self.changeColor = function (newColor) { self.color = newColor; ratGraphics.tint = newColor; }; self.update = function () { // Rat update logic here }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ var rat = game.addChild(new Rat()); rat.x = 1024; // Center horizontally rat.y = 1366; // Center vertically var colors = [0xff0000, 0x00ff00, 0x0000ff]; // Red, Green, Blue var paintBuckets = []; colors.forEach(function (color, index) { var bucket = game.addChild(new PaintBucket(color)); bucket.x = 300 + index * 600; // Position buckets horizontally with space between bucket.y = 2500; // Position buckets at the bottom paintBuckets.push(bucket); }); var cat = game.addChild(new Cat()); cat.x = 1024; // Start center horizontally cat.y = 100; // Start near the top LK.on('tick', function () { rat.update(); cat.update(); cat.checkRatCaught(); });
/****
* Classes
****/
// Cat class
var Cat = Container.expand(function () {
var self = Container.call(this);
var catGraphics = self.attachAsset('cat', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Cat update logic here
};
self.checkRatCaught = function () {
if (self.intersects(rat)) {
LK.showGameOver();
}
};
});
// PaintBucket class
var PaintBucket = Container.expand(function (color) {
var self = Container.call(this);
var bucketGraphics = self.attachAsset('paintBucket', {
anchorX: 0.5,
anchorY: 0.5
});
self.color = color;
bucketGraphics.tint = color;
self.on('down', function () {
rat.changeColor(self.color);
});
});
// Assets will be automatically created based on usage in the code.
// Rat class
var Rat = Container.expand(function () {
var self = Container.call(this);
var ratGraphics = self.attachAsset('rat', {
anchorX: 0.5,
anchorY: 0.5
});
self.color = 0xffffff; // Default color white
self.changeColor = function (newColor) {
self.color = newColor;
ratGraphics.tint = newColor;
};
self.update = function () {
// Rat update logic here
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
var rat = game.addChild(new Rat());
rat.x = 1024; // Center horizontally
rat.y = 1366; // Center vertically
var colors = [0xff0000, 0x00ff00, 0x0000ff]; // Red, Green, Blue
var paintBuckets = [];
colors.forEach(function (color, index) {
var bucket = game.addChild(new PaintBucket(color));
bucket.x = 300 + index * 600; // Position buckets horizontally with space between
bucket.y = 2500; // Position buckets at the bottom
paintBuckets.push(bucket);
});
var cat = game.addChild(new Cat());
cat.x = 1024; // Start center horizontally
cat.y = 100; // Start near the top
LK.on('tick', function () {
rat.update();
cat.update();
cat.checkRatCaught();
});
a cat carrying a knife. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a paint bucket. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a rat wearing a steampunk costume. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.