User prompt
footballer should kick the ball with strength
User prompt
ball should bounce off the walls according to physics
User prompt
ball should bounce much stronger after touching the footballer
User prompt
ball should bounce much higher when touches the ball
User prompt
increase score and text at the top after each touch of footballer
User prompt
game ends when ball touches the ground
User prompt
ball should bounce according to physics when it touches the footballer
User prompt
ball should fall down when game starts
User prompt
ball should fall down according to physics
User prompt
make physics according to shape and kick the ball when footballer touches ball
User prompt
add footballer which is controlled by mouse
User prompt
Fix Bug: 'ReferenceError: score is not defined' in this line: 'score += 1;' Line Number: 49
User prompt
increase score and reflect it in text at the top after every touch of footballer
User prompt
increase score after every touch of footballer and ball
User prompt
score should be number of kicks
User prompt
Fix Bug: 'ReferenceError: ballGraphics is not defined' in this line: 'var minDistance = ballGraphics.width / 2 + footballerGraphics.width / 2;' Line Number: 45
User prompt
ball should collide according to circle shapes of footballer and ball
User prompt
ball should bounce according to physics to the left and right
User prompt
ball should bounce higher when contacting footballer
User prompt
ball should bounce up when contacting the footballer
User prompt
ball should fall down when game starts
User prompt
ball should follow the gravity and go down according to it
User prompt
ball should start from the middle of screen
User prompt
make the collision physical and bounce according to shapes
User prompt
make ball circle
var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.createAsset('ball_circle', 'Juggling Ball Circle', .5, .5); self.speed = 0; self.move = function () { self.y += self.speed; self.speed += 0.1; }; self.bounce = function () { self.speed = -20; }; }); var Footballer = Container.expand(function () { var self = Container.call(this); var footballerGraphics = self.createAsset('footballer', 'Footballer', .5, 1); self.speed = 10; self.moveLeft = function () { self.x -= self.speed; }; self.moveRight = function () { self.x += self.speed; }; self.kick = function (ball) { if (ball.y >= self.y - ball.height && ball.x >= self.x - ball.width / 2 && ball.x <= self.x + ball.width / 2) { ball.bounce(); } }; }); var Game = Container.expand(function () { var self = Container.call(this); var ball = self.addChild(new Ball()); ball.x = 2048 / 2; ball.y = 2732 - 100; var footballer = self.addChild(new Footballer()); footballer.x = 2048 / 2; footballer.y = 2732 - footballer.height / 2; stage.on('move', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); footballer.x = pos.x; }); var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; LK.on('tick', function () { footballer.kick(ball); if (ball.speed < 0) { score++; scoreTxt.setText(score); } }); LK.on('tick', function () { ball.move(); if (ball.y > 2732) { isGameOver = true; } if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.createAsset('ball_circle', 'Juggling Ball Circle', .5, .5);
self.speed = 0;
self.move = function () {
self.y += self.speed;
self.speed += 0.1;
};
self.bounce = function () {
self.speed = -20;
};
});
var Footballer = Container.expand(function () {
var self = Container.call(this);
var footballerGraphics = self.createAsset('footballer', 'Footballer', .5, 1);
self.speed = 10;
self.moveLeft = function () {
self.x -= self.speed;
};
self.moveRight = function () {
self.x += self.speed;
};
self.kick = function (ball) {
if (ball.y >= self.y - ball.height && ball.x >= self.x - ball.width / 2 && ball.x <= self.x + ball.width / 2) {
ball.bounce();
}
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var ball = self.addChild(new Ball());
ball.x = 2048 / 2;
ball.y = 2732 - 100;
var footballer = self.addChild(new Footballer());
footballer.x = 2048 / 2;
footballer.y = 2732 - footballer.height / 2;
stage.on('move', function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
footballer.x = pos.x;
});
var score = 0;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
var isGameOver = false;
LK.on('tick', function () {
footballer.kick(ball);
if (ball.speed < 0) {
score++;
scoreTxt.setText(score);
}
});
LK.on('tick', function () {
ball.move();
if (ball.y > 2732) {
isGameOver = true;
}
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
});
});