var HappinessDisplay = Container.expand(function () { var self = Container.call(this); var happinessText = new Text2('Happiness: 100', { size: 100, fill: "#000000", align: 'center', font: 'bold' }); happinessText.anchor.set(0.5, 0); happinessText.y = 300; self.addChild(happinessText); self.happiness = 100; self.updateHappiness = function (increase) { if (increase) { self.happiness = Math.min(self.happiness + 10, 100); } else { self.happiness = Math.max(self.happiness - 10, 0); } if (self.happiness <= 80) { self.emit('updateStatus', 'Neutral'); } happinessText.setText('Happiness: ' + self.happiness); }; }); var TimerDisplay = Container.expand(function () { var self = Container.call(this); var timerText = new Text2('Time: 0', { size: 100, fill: "#ffffff", align: 'center', font: 'bold' }); timerText.anchor.set(0.5, 0); self.addChild(timerText); self.time = 0; self.updateTimer = function () { self.time++; timerText.setText('Time: ' + self.time); }; }); var HungerDisplay = Container.expand(function () { var self = Container.call(this); var hungerText = new Text2('Hunger: 100', { size: 100, fill: "#000000", align: 'center', font: 'bold' }); hungerText.anchor.set(0.5, 0); hungerText.y = 200; self.addChild(hungerText); self.hunger = 100; self.emit('updateStatus', 'Happy'); self.updateHunger = function (increase) { var status; self.hunger = increase ? Math.min(self.hunger + 10, 100) : Math.max(self.hunger - 10, 0); var status; var imageId; if (self.hunger > 80) { status = 'Happy'; imageId = 'happy_buckmon'; } else if (self.hunger === 80) { status = 'Neutral'; imageId = 'neutral_buckmon'; } else if (self.hunger > 30) { status = 'Hungry'; imageId = 'hungry_buckmon'; } else { status = 'Sad'; imageId = 'hungry_buckmon'; } hungerText.setText('Hunger: ' + self.hunger); self.emit('updateStatus', status); self.emit('updateBuckmonImage', imageId); }; }); var StatusDisplay = Container.expand(function () { var self = Container.call(this); var statusText = new Text2('Status: Happy', { size: 100, fill: "#000000", align: 'center', font: 'bold' }); statusText.anchor.set(0.5, 0); statusText.y = 100; self.addChild(statusText); self.updateStatus = function (newStatus) { var statusOrder = ['Happy', 'Neutral', 'Hungry', 'Sad']; var statusIndex = statusOrder.indexOf(newStatus); statusText.setText('Status: ' + statusOrder[statusIndex]); }; }); var LevelDisplay = Container.expand(function () { var self = Container.call(this); var levelText = new Text2('Level: 1', { size: 100, fill: "#ffffff", align: 'center', font: 'bold' }); levelText.anchor.set(0.5, 0); levelText.y = 50; self.addChild(levelText); self.level = 1; self.updateLevel = function () { self.level++; levelText.setText('Level: ' + self.level); }; }); var DanceButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('danceButton', 'Dance Button Graphics', 0.5, 0.5); self.on('down', function () { self.emit('updateHappiness', true); }); }); var FeedButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('feedButton', 'Feed Button Graphics', 0.5, 0.5); self.on('down', function () { self.emit('feedBuckmon', true); }); }); var Buckmon = Container.expand(function () { var self = Container.call(this); self.happinessScore = 100; self.hungerStatus = 100; self.buckmonGraphics = self.createAsset('happy_buckmon', 'Buckmon Graphics', .5, .5); self.emit('updateBuckmonImage', 'happy_buckmon'); self.on('updateBuckmonImage', function (imageId) { var newTexture = LK.getAsset(imageId, 'Buckmon Graphics', .5, .5).texture; if (newTexture) { self.buckmonGraphics.texture = newTexture; } }); self.feed = function () { self.emit('updateStatus', 'Happy'); }; self.dance = function () { self.emit('updateStatus', 'Neutral'); }; self.chat = function () { var chatBubble = self.createAsset('chatBubble', 'Chat Bubble Graphics', 0.5, -0.5); chatBubble.y = -self.height; self.addChild(chatBubble); var chatText = new Text2('Let\'s Krump!', { size: 80, fill: "#ffffff", align: 'center' }); chatText.anchor.set(0.5, 0.5); chatText.y = -self.height * 0.5; chatBubble.addChild(chatText); LK.setTimeout(function () { chatBubble.destroy(); }, 3000); }; }); var Game = Container.expand(function () { var self = Container.call(this); var danceButton = self.addChild(new DanceButton()); danceButton.x = 2048 / 2 + 300; danceButton.y = 2732 - 200; danceButton.on('updateHappiness', function (increase) { happinessDisplay.updateHappiness(increase); }); var background = self.createAsset('background', 'Game Background', 0, 0); background.width = 2048; background.height = 2732; self.addChildAt(background, 0); var buckmon = self.addChild(new Buckmon()); buckmon.x = 2048 / 2; buckmon.y = 2732 / 2; buckmon.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); if (pos.x < buckmon.x + buckmon.width / 2 && pos.x > buckmon.x - buckmon.width / 2) { if (pos.y < buckmon.y) { buckmon.feed(); } else if (pos.y > buckmon.y && pos.y < buckmon.y + buckmon.height / 2) { buckmon.dance(); } else if (pos.y > buckmon.y + buckmon.height / 2) { buckmon.chat(); } } }); var feedButton = self.addChild(new FeedButton()); feedButton.x = 2048 / 2 - 300; feedButton.y = 2732 - 200; feedButton.on('feedBuckmon', function (increase) { hungerDisplay.updateHunger(increase); }); var hungerDisplay = self.addChild(new HungerDisplay()); hungerDisplay.x = 2048 / 2; hungerDisplay.y = 250; var statusDisplay = self.addChild(new StatusDisplay()); statusDisplay.x = 2048 / 2; statusDisplay.y = 150; var levelDisplay = self.addChild(new LevelDisplay()); levelDisplay.x = 2048 / 2; levelDisplay.y = 0; var timerDisplay = self.addChild(new TimerDisplay()); timerDisplay.x = 150; timerDisplay.y = 50; buckmon.on('updateStatus', function (status) { statusDisplay.updateStatus(status); }); var hungerDecreaseInterval = LK.setInterval(function () { hungerDisplay.updateHunger(); }, 10000); var levelIncreaseInterval = LK.setInterval(function () { levelDisplay.updateLevel(); }, 300000); var timerUpdateInterval = LK.setInterval(function () { timerDisplay.updateTimer(); }, 1000); var happinessDisplay = self.addChild(new HappinessDisplay()); happinessDisplay.x = 2048 / 2; happinessDisplay.y = 350; var happinessDecreaseInterval = LK.setInterval(function () { happinessDisplay.updateHappiness(false); }, 10000); LK.on('tick', function () {}); });
var HappinessDisplay = Container.expand(function () {
var self = Container.call(this);
var happinessText = new Text2('Happiness: 100', {
size: 100,
fill: "#000000",
align: 'center',
font: 'bold'
});
happinessText.anchor.set(0.5, 0);
happinessText.y = 300;
self.addChild(happinessText);
self.happiness = 100;
self.updateHappiness = function (increase) {
if (increase) {
self.happiness = Math.min(self.happiness + 10, 100);
} else {
self.happiness = Math.max(self.happiness - 10, 0);
}
if (self.happiness <= 80) {
self.emit('updateStatus', 'Neutral');
}
happinessText.setText('Happiness: ' + self.happiness);
};
});
var TimerDisplay = Container.expand(function () {
var self = Container.call(this);
var timerText = new Text2('Time: 0', {
size: 100,
fill: "#ffffff",
align: 'center',
font: 'bold'
});
timerText.anchor.set(0.5, 0);
self.addChild(timerText);
self.time = 0;
self.updateTimer = function () {
self.time++;
timerText.setText('Time: ' + self.time);
};
});
var HungerDisplay = Container.expand(function () {
var self = Container.call(this);
var hungerText = new Text2('Hunger: 100', {
size: 100,
fill: "#000000",
align: 'center',
font: 'bold'
});
hungerText.anchor.set(0.5, 0);
hungerText.y = 200;
self.addChild(hungerText);
self.hunger = 100;
self.emit('updateStatus', 'Happy');
self.updateHunger = function (increase) {
var status;
self.hunger = increase ? Math.min(self.hunger + 10, 100) : Math.max(self.hunger - 10, 0);
var status;
var imageId;
if (self.hunger > 80) {
status = 'Happy';
imageId = 'happy_buckmon';
} else if (self.hunger === 80) {
status = 'Neutral';
imageId = 'neutral_buckmon';
} else if (self.hunger > 30) {
status = 'Hungry';
imageId = 'hungry_buckmon';
} else {
status = 'Sad';
imageId = 'hungry_buckmon';
}
hungerText.setText('Hunger: ' + self.hunger);
self.emit('updateStatus', status);
self.emit('updateBuckmonImage', imageId);
};
});
var StatusDisplay = Container.expand(function () {
var self = Container.call(this);
var statusText = new Text2('Status: Happy', {
size: 100,
fill: "#000000",
align: 'center',
font: 'bold'
});
statusText.anchor.set(0.5, 0);
statusText.y = 100;
self.addChild(statusText);
self.updateStatus = function (newStatus) {
var statusOrder = ['Happy', 'Neutral', 'Hungry', 'Sad'];
var statusIndex = statusOrder.indexOf(newStatus);
statusText.setText('Status: ' + statusOrder[statusIndex]);
};
});
var LevelDisplay = Container.expand(function () {
var self = Container.call(this);
var levelText = new Text2('Level: 1', {
size: 100,
fill: "#ffffff",
align: 'center',
font: 'bold'
});
levelText.anchor.set(0.5, 0);
levelText.y = 50;
self.addChild(levelText);
self.level = 1;
self.updateLevel = function () {
self.level++;
levelText.setText('Level: ' + self.level);
};
});
var DanceButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.createAsset('danceButton', 'Dance Button Graphics', 0.5, 0.5);
self.on('down', function () {
self.emit('updateHappiness', true);
});
});
var FeedButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.createAsset('feedButton', 'Feed Button Graphics', 0.5, 0.5);
self.on('down', function () {
self.emit('feedBuckmon', true);
});
});
var Buckmon = Container.expand(function () {
var self = Container.call(this);
self.happinessScore = 100;
self.hungerStatus = 100;
self.buckmonGraphics = self.createAsset('happy_buckmon', 'Buckmon Graphics', .5, .5);
self.emit('updateBuckmonImage', 'happy_buckmon');
self.on('updateBuckmonImage', function (imageId) {
var newTexture = LK.getAsset(imageId, 'Buckmon Graphics', .5, .5).texture;
if (newTexture) {
self.buckmonGraphics.texture = newTexture;
}
});
self.feed = function () {
self.emit('updateStatus', 'Happy');
};
self.dance = function () {
self.emit('updateStatus', 'Neutral');
};
self.chat = function () {
var chatBubble = self.createAsset('chatBubble', 'Chat Bubble Graphics', 0.5, -0.5);
chatBubble.y = -self.height;
self.addChild(chatBubble);
var chatText = new Text2('Let\'s Krump!', {
size: 80,
fill: "#ffffff",
align: 'center'
});
chatText.anchor.set(0.5, 0.5);
chatText.y = -self.height * 0.5;
chatBubble.addChild(chatText);
LK.setTimeout(function () {
chatBubble.destroy();
}, 3000);
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var danceButton = self.addChild(new DanceButton());
danceButton.x = 2048 / 2 + 300;
danceButton.y = 2732 - 200;
danceButton.on('updateHappiness', function (increase) {
happinessDisplay.updateHappiness(increase);
});
var background = self.createAsset('background', 'Game Background', 0, 0);
background.width = 2048;
background.height = 2732;
self.addChildAt(background, 0);
var buckmon = self.addChild(new Buckmon());
buckmon.x = 2048 / 2;
buckmon.y = 2732 / 2;
buckmon.on('down', function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
if (pos.x < buckmon.x + buckmon.width / 2 && pos.x > buckmon.x - buckmon.width / 2) {
if (pos.y < buckmon.y) {
buckmon.feed();
} else if (pos.y > buckmon.y && pos.y < buckmon.y + buckmon.height / 2) {
buckmon.dance();
} else if (pos.y > buckmon.y + buckmon.height / 2) {
buckmon.chat();
}
}
});
var feedButton = self.addChild(new FeedButton());
feedButton.x = 2048 / 2 - 300;
feedButton.y = 2732 - 200;
feedButton.on('feedBuckmon', function (increase) {
hungerDisplay.updateHunger(increase);
});
var hungerDisplay = self.addChild(new HungerDisplay());
hungerDisplay.x = 2048 / 2;
hungerDisplay.y = 250;
var statusDisplay = self.addChild(new StatusDisplay());
statusDisplay.x = 2048 / 2;
statusDisplay.y = 150;
var levelDisplay = self.addChild(new LevelDisplay());
levelDisplay.x = 2048 / 2;
levelDisplay.y = 0;
var timerDisplay = self.addChild(new TimerDisplay());
timerDisplay.x = 150;
timerDisplay.y = 50;
buckmon.on('updateStatus', function (status) {
statusDisplay.updateStatus(status);
});
var hungerDecreaseInterval = LK.setInterval(function () {
hungerDisplay.updateHunger();
}, 10000);
var levelIncreaseInterval = LK.setInterval(function () {
levelDisplay.updateLevel();
}, 300000);
var timerUpdateInterval = LK.setInterval(function () {
timerDisplay.updateTimer();
}, 1000);
var happinessDisplay = self.addChild(new HappinessDisplay());
happinessDisplay.x = 2048 / 2;
happinessDisplay.y = 350;
var happinessDecreaseInterval = LK.setInterval(function () {
happinessDisplay.updateHappiness(false);
}, 10000);
LK.on('tick', function () {});
});
A cute monster wearing a snapback and Timberland shoes in Chibi style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A boombox icon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A fried chicken thigh icon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A forest with boombox, dance floor and mirror Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.