User prompt
Não é do vaso, é da pessoa.
User prompt
Você tem que mudar a velocidade dele. Aumenta a velocidade, aí ele aparece.
User prompt
Eu tô vendo as moedas indo, só que não tá mudando nem a variável e ele não tá aparecendo.
User prompt
Faça com que ele ande a cada 5 segundos e dropa uma moeda no vaso, que na verdade é uma bolsa.
User prompt
Ele tem que estar do mesmo tamanho que o objeto aplicável, e ele tem que sair da tela.
User prompt
Adicione a pessoa 1 e quando ele estiver andando, usa os 3 sprites ou 4 dela.
User prompt
É, eu acho que tá meio bizarro porque o objeto clicável tá flutuando.
User prompt
Adicione o fundo, mas o fundo tem que estar no tamanho da tela.
User prompt
Não, a animação da moeda tá mó lenta.
User prompt
Faça com que a moeda tenha uma animação dela indo pra bolsa e sumindo.
User prompt
Passa a ponte, amoeba.
User prompt
Faça com que quando clicado, acontece uma emação da moeda sendo dropada no vaso, que na verdade é uma bolsa.
User prompt
Com certeza é isso, não tá funcionando, não.
User prompt
na direita do personagem.
User prompt
Adicione o vaso, que na verdade é uma mochila, e coloque na cena também.
User prompt
Clicar em qualquer canto da tela para aumentar a variável.
User prompt
Aumente muito mais
User prompt
Não tô conseguindo nem ver ele.
User prompt
Aumenta 200 vezes o tamanho dele.
User prompt
Caramba, mano. Ele tá tão pequeno que tá parecendo uma formiga. Aumenta o tamanho dele aí.
Initial prompt
Click.
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for the clickable object
var ClickableObject = Container.expand(function () {
var self = Container.call(this);
var clickableGraphics = self.attachAsset('clickable', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 4
});
// Event handler for when the object is clicked
self.down = function (x, y, obj) {
// Increase score
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
// Flash the object to give feedback
LK.effects.flashObject(self, 0xffffff, 100);
// Create a new coin and add it to the game
var coin = game.addChild(new Coin());
coin.x = self.x;
coin.y = self.y;
// Animate the coin dropping into the vase
coin.drop();
};
});
// Class for the coin
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('Coin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5
});
// Method for the coin dropping animation
self.drop = function () {
var dropInterval = LK.setInterval(function () {
// Calculate the direction vector from the coin to the vase
var dx = vase.x - self.x;
var dy = vase.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// Normalize the direction vector
dx /= distance;
dy /= distance;
// Move the coin towards the vase
self.x += dx * 20; // Increase the speed of the coin
self.y += dy * 20; // Increase the speed of the coin
// If the coin reaches the vase, clear the interval and destroy the coin
if (self.intersects(vase)) {
LK.clearInterval(dropInterval);
self.destroy();
}
}, 50);
};
});
// Class for Person1
var Person1 = Container.expand(function () {
var self = Container.call(this);
var person1Graphics = self.attachAsset('Person1sprite1', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
});
// Method for the walking animation
self.walk = function () {
var walkInterval = LK.setInterval(function () {
// Cycle through the sprites for the walking animation
if (person1Graphics.id === 'Person1sprite1') {
person1Graphics = self.attachAsset('Person1sprite2', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
});
} else if (person1Graphics.id === 'Person1sprite2') {
person1Graphics = self.attachAsset('Person1sprite3', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
});
} else {
person1Graphics = self.attachAsset('Person1sprite1', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
});
}
}, 200);
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize score text
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Add the Background asset to the game scene
var background = game.addChild(LK.getAsset('Background', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2048 / 100,
// Scale to fit the screen width
scaleY: 2732 / 100,
// Scale to fit the screen height
x: 2048 / 2,
y: 2732 / 2
}));
// Create the clickable object and position it at the bottom of the screen
var clickableObject = game.addChild(new ClickableObject());
clickableObject.x = 2048 / 2;
clickableObject.y = 2732 - clickableObject.height / 2;
// Add the Vase asset to the game scene
var vase = game.addChild(LK.getAsset('Vase', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2,
x: clickableObject.x + clickableObject.width + 100,
y: clickableObject.y
}));
// Create Person1 and start the walking animation
var person1 = game.addChild(new Person1());
person1.x = 2048 / 2;
person1.y = 2732 - person1.height / 2;
person1.walk();
// Game update loop
game.update = function () {
// Game logic can be added here if needed
};
// Removed the game.down event handler ===================================================================
--- original.js
+++ change.js
@@ -56,8 +56,46 @@
}
}, 50);
};
});
+// Class for Person1
+var Person1 = Container.expand(function () {
+ var self = Container.call(this);
+ var person1Graphics = self.attachAsset('Person1sprite1', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1,
+ scaleY: 1
+ });
+ // Method for the walking animation
+ self.walk = function () {
+ var walkInterval = LK.setInterval(function () {
+ // Cycle through the sprites for the walking animation
+ if (person1Graphics.id === 'Person1sprite1') {
+ person1Graphics = self.attachAsset('Person1sprite2', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1,
+ scaleY: 1
+ });
+ } else if (person1Graphics.id === 'Person1sprite2') {
+ person1Graphics = self.attachAsset('Person1sprite3', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1,
+ scaleY: 1
+ });
+ } else {
+ person1Graphics = self.attachAsset('Person1sprite1', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1,
+ scaleY: 1
+ });
+ }
+ }, 200);
+ };
+});
/****
* Initialize Game
****/
@@ -98,8 +136,13 @@
scaleY: 2,
x: clickableObject.x + clickableObject.width + 100,
y: clickableObject.y
}));
+// Create Person1 and start the walking animation
+var person1 = game.addChild(new Person1());
+person1.x = 2048 / 2;
+person1.y = 2732 - person1.height / 2;
+person1.walk();
// Game update loop
game.update = function () {
// Game logic can be added here if needed
};