User prompt
If the ball is touching upside and downside of ground then the game will end
User prompt
More bounce
User prompt
Make the ball lighter so it will bounce more
User prompt
Why it is not going when I hit the ball why the game is not ending after it touches the downside of ground
User prompt
It is again blocking in the upside where is gravity
User prompt
If the ball goes up it will go up only it will not blocked after some time it will come in the field again I told it
User prompt
It has to be faster I told it
User prompt
When the ball is going down players can't juggle it it will over I said it
Initial prompt
Kick ups
/****
* Classes
****/
// Ball class to handle ball behavior
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 5;
self.directionY = 1; // 1 for down, -1 for up
self.update = function () {
self.y += self.speedY * self.directionY;
if (self.y > 2732 - ballGraphics.height / 2) {
self.directionY = -1;
} else if (self.y < ballGraphics.height / 2) {
self.directionY = 1;
}
};
});
// Boot class to handle boot behavior
var Boot = Container.expand(function () {
var self = Container.call(this);
var bootGraphics = self.attachAsset('boot', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
self.x = x;
self.y = y;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize game elements
// Assets will be automatically created and loaded by the LK engine based on their usage in the code.
// Initialize assets used in this game.
var footballGround = LK.getAsset('footballGround', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(footballGround);
var ball = game.addChild(new Ball());
ball.x = 2048 / 2;
ball.y = 2732 / 4;
var boot = game.addChild(new Boot());
boot.x = 2048 / 2;
boot.y = 2732 - 200;
var score = 0;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Handle game move events
game.move = function (x, y, obj) {
boot.x = x;
boot.y = y;
};
// Handle game update
game.update = function () {
ball.update();
if (ball.intersects(boot)) {
ball.directionY = -1;
score += 1;
scoreTxt.setText(score);
}
if (ball.y > 2732) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
};
Football ground from middle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A foot ball boot. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Football. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.