User prompt
Aumente o tamanho do Pou e tire as informações uma em cima da outra e coloque uma informação em cada lugar. Adicione três botões: Loja: Abre uma mine loja com alimentos para comprar para o Pou comer,precisa de moedas para comprar cada alimento,os alimentos que aumentam mais a Barra de fome devem ser mais caros custando mais moedas. Jogos: Joguinhos divertidos para deixar o Pou feliz como Jogo da velha,Jogo de luta é muito mais,quando mais tempo você dura em um joguinho mais moedas você ganha quando você perde. Cama: Uma cama para descansar o Pou e depois volta a fazer as coisas. Enquanto o Pou dorme nenhuma Barra murda apenas a Barra de energia que aumenta.
Initial prompt
Pou
/**** * Classes ****/ // Assets will be automatically created and loaded by the LK engine based on their usage in the code. // Class for Pou, the pet var Pou = Container.expand(function () { var self = Container.call(this); var pouGraphics = self.attachAsset('pou', { anchorX: 0.5, anchorY: 0.5 }); self.hunger = 100; self.energy = 100; self.happiness = 100; self.update = function () { // Decrease stats over time self.hunger -= 0.05; self.energy -= 0.02; self.happiness -= 0.03; // Check if Pou is dead if (self.hunger <= 0 || self.energy <= 0 || self.happiness <= 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }; self.feed = function () { self.hunger = Math.min(self.hunger + 20, 100); }; self.play = function () { self.happiness = Math.min(self.happiness + 20, 100); }; self.sleep = function () { self.energy = Math.min(self.energy + 20, 100); }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ var pou = game.addChild(new Pou()); pou.x = 2048 / 2; pou.y = 2732 / 2; var hungerText = new Text2('Hunger: 100', { size: 50, fill: "#ffffff" }); hungerText.anchor.set(0.5, 0); LK.gui.topLeft.addChild(hungerText); var energyText = new Text2('Energy: 100', { size: 50, fill: "#ffffff" }); energyText.anchor.set(0.5, 0); LK.gui.top.addChild(energyText); var happinessText = new Text2('Happiness: 100', { size: 50, fill: "#ffffff" }); happinessText.anchor.set(0.5, 0); LK.gui.topRight.addChild(happinessText); game.update = function () { hungerText.setText('Hunger: ' + Math.floor(pou.hunger)); energyText.setText('Energy: ' + Math.floor(pou.energy)); happinessText.setText('Happiness: ' + Math.floor(pou.happiness)); }; game.down = function (x, y, obj) { var game_position = game.toLocal(obj.global); if (game_position.x < 2048 / 4) { pou.feed(); } else if (game_position.x < 2048 * 2 / 4) { pou.play(); } else if (game_position.x < 2048 * 3 / 4) { pou.sleep(); } else { // Open shop, play games, or go to bed } };
===================================================================
--- original.js
+++ change.js
@@ -1,82 +1,84 @@
-/****
+/****
* Classes
-****/
+****/
// Assets will be automatically created and loaded by the LK engine based on their usage in the code.
// Class for Pou, the pet
var Pou = Container.expand(function () {
- var self = Container.call(this);
- var pouGraphics = self.attachAsset('pou', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.hunger = 100;
- self.energy = 100;
- self.happiness = 100;
- self.update = function () {
- // Decrease stats over time
- self.hunger -= 0.05;
- self.energy -= 0.02;
- self.happiness -= 0.03;
- // Check if Pou is dead
- if (self.hunger <= 0 || self.energy <= 0 || self.happiness <= 0) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- }
- };
- self.feed = function () {
- self.hunger = Math.min(self.hunger + 20, 100);
- };
- self.play = function () {
- self.happiness = Math.min(self.happiness + 20, 100);
- };
- self.sleep = function () {
- self.energy = Math.min(self.energy + 20, 100);
- };
+ var self = Container.call(this);
+ var pouGraphics = self.attachAsset('pou', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.hunger = 100;
+ self.energy = 100;
+ self.happiness = 100;
+ self.update = function () {
+ // Decrease stats over time
+ self.hunger -= 0.05;
+ self.energy -= 0.02;
+ self.happiness -= 0.03;
+ // Check if Pou is dead
+ if (self.hunger <= 0 || self.energy <= 0 || self.happiness <= 0) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ }
+ };
+ self.feed = function () {
+ self.hunger = Math.min(self.hunger + 20, 100);
+ };
+ self.play = function () {
+ self.happiness = Math.min(self.happiness + 20, 100);
+ };
+ self.sleep = function () {
+ self.energy = Math.min(self.energy + 20, 100);
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 // Init game with black background
+ backgroundColor: 0x000000 // Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
var pou = game.addChild(new Pou());
pou.x = 2048 / 2;
pou.y = 2732 / 2;
var hungerText = new Text2('Hunger: 100', {
- size: 50,
- fill: "#ffffff"
+ size: 50,
+ fill: "#ffffff"
});
hungerText.anchor.set(0.5, 0);
-LK.gui.top.addChild(hungerText);
+LK.gui.topLeft.addChild(hungerText);
var energyText = new Text2('Energy: 100', {
- size: 50,
- fill: "#ffffff"
+ size: 50,
+ fill: "#ffffff"
});
energyText.anchor.set(0.5, 0);
LK.gui.top.addChild(energyText);
var happinessText = new Text2('Happiness: 100', {
- size: 50,
- fill: "#ffffff"
+ size: 50,
+ fill: "#ffffff"
});
happinessText.anchor.set(0.5, 0);
-LK.gui.top.addChild(happinessText);
+LK.gui.topRight.addChild(happinessText);
game.update = function () {
- hungerText.setText('Hunger: ' + Math.floor(pou.hunger));
- energyText.setText('Energy: ' + Math.floor(pou.energy));
- happinessText.setText('Happiness: ' + Math.floor(pou.happiness));
+ hungerText.setText('Hunger: ' + Math.floor(pou.hunger));
+ energyText.setText('Energy: ' + Math.floor(pou.energy));
+ happinessText.setText('Happiness: ' + Math.floor(pou.happiness));
};
game.down = function (x, y, obj) {
- var game_position = game.toLocal(obj.global);
- if (game_position.x < 2048 / 3) {
- pou.feed();
- } else if (game_position.x < 2048 * 2 / 3) {
- pou.play();
- } else {
- pou.sleep();
- }
+ var game_position = game.toLocal(obj.global);
+ if (game_position.x < 2048 / 4) {
+ pou.feed();
+ } else if (game_position.x < 2048 * 2 / 4) {
+ pou.play();
+ } else if (game_position.x < 2048 * 3 / 4) {
+ pou.sleep();
+ } else {
+ // Open shop, play games, or go to bed
+ }
};
\ No newline at end of file