User prompt
ball shoud accelerate faster over time
User prompt
make it harder after each 5 points
User prompt
make it harder to score 20 points - ball should be much faster when you reach 20 points
User prompt
make it harder to kick the ball over time
User prompt
ball should bounce to approximately the same height every time
User prompt
ball should bounce a bit stronger when hitting footballer
User prompt
ball should bounce 20% stronger when hitting footballer
User prompt
ball should bounce less stronger when hitting footballer
User prompt
ball should bounce a bit stronger when hitting footballer
User prompt
ball should bounce much stronger when hitting footballer
User prompt
ball should bounce much stronger when hitting footballer
User prompt
ball should bounce much more higher
User prompt
ball should bounce much higher after collision
User prompt
gravity and ball speed should increase over time
User prompt
increase ball speed during the game progression - from slow to fast
User prompt
increase top score after each touch between footballer and ball
User prompt
make footballer twice smaller
User prompt
make kicks much stronger
User prompt
make the bounce much stronger
User prompt
make collisions according to physics
User prompt
make collide of shapes according to physics
User prompt
ball and footballer should never intersect each other
User prompt
make the footballer 4 times bigger
var Footballer = Container.expand(function () { var self = Container.call(this); var footballerGraphics = self.createAsset('footballer', 'Player Footballer', .5, 1); footballerGraphics.scale.set(2); self.move = function (position) { self.x = position.x; }; }); var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.createAsset('ball', 'Juggling Ball', .5, .5); self.speedY = -5; self.speedModifier = 0; self.move = function () { self.x += self.speedX; self.y += self.speedY; self.speedY += 0.98 + LK.ticks / 50000; if (self.y >= 2732 - self.height / 2) { self.y = 2732 - self.height / 2; self.speedY = -60; } if (self.x <= 0) { self.x = 0; self.speedX *= -1; } if (self.x >= 2048 - self.width) { self.x = 2048 - self.width; self.speedX *= -1; } if (self.y < 0) { self.speedY *= -0.5; } }; self.bounce = function (speedX, speedY) { self.speedX = speedX; var difficultyMultiplier = 1 + Math.floor(score / 5) * 0.1; self.speedY = (speedY * (5.4 + difficultyMultiplier) + LK.ticks / 1800) * (1 + LK.ticks / 50000); }; }); var Game = Container.expand(function () { var self = Container.call(this); var ball = self.addChild(new Ball()); ball.x = 2048 / 2; ball.y = 2732 / 2; 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.move(pos); }); 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; ball.on('down', function (obj) { var kickStrengthX = 0; var kickStrengthY = -20; ball.bounce(kickStrengthX, kickStrengthY); score++; scoreTxt.setText(score); }); LK.on('tick', function () { ball.move(); if (ball.intersects(footballer) && ball.speedY > 0) { var relativeIntersectX = ball.x + ball.width / 2 - (footballer.x + footballer.width / 2); var normalizedRelativeIntersectionX = 2 * relativeIntersectX / footballer.width; var bounceAngle = normalizedRelativeIntersectionX * Math.PI / 4; ball.speedY = -60 * Math.cos(bounceAngle); ball.speedX = 60 * Math.sin(bounceAngle); score++; scoreTxt.setText(score); } if (ball.y >= 2732 - ball.height / 2) { isGameOver = true; } if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -13,9 +13,9 @@
self.speedModifier = 0;
self.move = function () {
self.x += self.speedX;
self.y += self.speedY;
- self.speedY += 0.98;
+ self.speedY += 0.98 + LK.ticks / 50000;
if (self.y >= 2732 - self.height / 2) {
self.y = 2732 - self.height / 2;
self.speedY = -60;
}