User prompt
only show the digit off the score text
User prompt
center the text
User prompt
Make the score text green and on the top center
User prompt
update the score text after launch base off the distance bewten the hand and the stone
User prompt
show the score
User prompt
increase the gravity after launch to 20 time
User prompt
increse the gravity off the launch by 5 time
User prompt
increse the power off the slowing off the stone after launch base on the gravity
User prompt
the launch have to be slighty reduce over time
User prompt
the launch have to stop base on gravity
User prompt
increse the gravity of the stone by 10 time
User prompt
the launch have to have gravity applied
User prompt
apply the gravity off the stone only after launch
User prompt
aplay gravity on the launch
User prompt
reduce the power off the launch by 5 time
User prompt
the bounce is moving up with the same power as the launch
User prompt
the first bounce alway apai
User prompt
bounce as half the power off the launch
User prompt
the chance off bounce have to be 90 percent
User prompt
the chance of ricochet have to be 90 percent
User prompt
the bounce have to apain only upward
User prompt
the chance of bounce have to be 80 percent and have to be split in half after each bounce
User prompt
Reduce the power of the launch 10 time
User prompt
Reduce the power off the launch by 10
User prompt
Double the chance off bounce
var SixthFingerBar = Container.expand(function () { var self = Container.call(this); var sixthFingerBarGraphics = self.createAsset('sixthFingerBar', 'Sixth finger bar display', 0, 0.5); var sixthFingerLabel = new Text2('Sixth Finger Strength', { size: 400, fill: "#ffffff", align: 'center' }); sixthFingerLabel.x = self.width / 2; sixthFingerLabel.y = -self.height; self.addChild(sixthFingerLabel); self.width = 375; self.height = 75; self.x = 1024 - self.width / 2; self.y = 2732 - 300; self.visible = false; self.isShowing = false; self.progress = 50; self.show = function () { self.visible = true; self.isShowing = true; self.incrementProgress = LK.setInterval(function () { if (self.progress < 100 && self.direction !== -1) { self.updateProgress(self.progress + 6); } else if (self.progress >= 100) { self.direction = -1; } if (self.progress > 0 && self.direction === -1) { self.updateProgress(self.progress - 6); } else if (self.progress <= 0) { self.direction = 1; } }, 50); }; self.hide = function () { self.visible = false; self.isShowing = false; LK.clearInterval(self.incrementProgress); }; self.updateProgress = function (value) { self.progress = value; sixthFingerBarGraphics.scale.x = self.progress / 100; sixthFingerLabel.setText('Sixth Finger Strength: ' + self.progress + '%'); }; }); var WindBar = Container.expand(function () { var self = Container.call(this); var windBarGraphics = self.createAsset('windBar', 'Wind bar display', 0, 0.5); var windLabel = new Text2('Wind', { size: 400, fill: "#ffffff", align: 'center' }); windLabel.x = self.width / 2; windLabel.y = -self.height; self.addChild(windLabel); self.width = 375; self.height = 75; self.x = 1024 - self.width / 2; self.y = 2732 - 200; self.visible = false; self.isShowing = false; self.strength = 50; self.direction = 1; self.show = function () { self.visible = true; self.isShowing = true; self.updateWind = LK.setInterval(function () { if (self.strength < 100 && self.direction !== -1) { self.strength++; } else if (self.strength >= 100) { self.direction = -1; } if (self.strength > 1 && self.direction === -1) { self.strength--; } else if (self.strength <= 1) { self.direction = 1; } windBarGraphics.scale.x = self.strength / 100; windBarGraphics.scale.x *= self.direction; windLabel.setText('Wind: ' + self.strength + '%'); }, 50); }; self.hide = function () { self.visible = false; self.isShowing = false; LK.clearInterval(self.updateWind); }; self.updateWindDisplay = function () {}; }); var RestartButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('restartButton', 'Restart button', 0.5, 0.5); self.x = 2048 / 2; self.y = 2732 - 200; buttonGraphics.on('down', function () { LK.showGameOver(); }); }); var PowerBar = Container.expand(function () { var self = Container.call(this); var powerBarGraphics = self.createAsset('powerBar', 'Power bar display', 0, 0.5); var powerLabel = new Text2('Power', { size: 400, fill: "#ffffff", align: 'center' }); powerLabel.x = self.width / 2; powerLabel.y = -self.height; self.addChild(powerLabel); self.width = 375; self.height = 75; self.x = 1024 - self.width / 2; self.y = 2732 - 100; self.visible = false; self.isShowing = false; self.progress = 50; self.show = function () { self.visible = true; self.isShowing = true; self.incrementProgress = LK.setInterval(function () { if (self.progress < 100 && self.direction !== -1) { self.updateProgress(self.progress + 3); } else if (self.progress >= 100) { self.direction = -1; } if (self.progress > 0 && self.direction === -1) { self.updateProgress(self.progress - 3); } else if (self.progress <= 0) { self.direction = 1; } }, 50); }; self.hide = function () { self.visible = false; self.isShowing = false; LK.clearInterval(self.incrementProgress); }; self.updateProgress = function (value) { self.progress = value; powerBarGraphics.scale.x = self.progress / 100; powerLabel.setText('Power: ' + self.progress + '%'); }; }); var Hand = Container.expand(function () { var self = Container.call(this); self.move = function (position, stone) { self.x = position.x; if (!stone.isLaunched) { stone.x = self.x; } }; var handGraphics = self.createAsset('hand', 'Moving hand at the bottom', 0.5, 0.5); self.x = 0; self.y = 2732 - handGraphics.height / 2; self.direction = 1; self.speed = 5; }); var Stone = Container.expand(function () { var self = Container.call(this); self.launch = function (hand, powerBarProgress, windBarStrength, sixthFingerBarProgress) { self.x = hand.x; self.y = hand.y; self.direction = -Math.PI / 2; var averagePower = (powerBarProgress + windBarStrength + sixthFingerBarProgress) / 3; self.launchPower = averagePower * 4.8; self.speedX = self.launchPower * Math.cos(self.direction) * 0.01; self.speedY = -self.speedY * 0.7; self.isLaunched = true; self.distanceTraveled = 0; self.bounceChance = 1; LK.setScore(0); }; var stoneGraphics = self.createAsset('stone', 'Stone for ricochet', .5, .5); self.speedX = 0; self.speedY = 0; self.direction = 0; self.isLaunched = false; self.move = function (lake) { self.x += self.speedX; self.y += self.speedY; self.speedX *= 0.95; self.launchPower *= 0.99; if (self.isLaunched) { self.speedY += 9.8 * 1.5 * 20; } if (self.isLaunched) { self.distanceTraveled += self.speed; LK.setScore(Math.floor(self.distanceTraveled)); if (lake.checkRicochet(self) && Math.random() < self.bounceChance) { self.direction = -Math.PI / 2; self.speedX = self.launchPower * Math.cos(self.direction) * 0.01; self.speedY = self.launchPower * Math.sin(self.direction) * 0.01; self.bounceChance = 1; } if (Math.abs(self.speedY) < 0.1) { self.speedX = 0; self.speedY = 0; if (!self.isStopped) { LK.setTimeout(function () { LK.showGameOver(); }, 3000); self.isStopped = true; } } } }; }); var Lake = Container.expand(function () { var self = Container.call(this); var lakeGraphics = self.createAsset('lake', 'Lake for stone ricochet', .5, .5); self.checkRicochet = function (stone) { if (stone.intersects(this)) { return true; } return false; }; }); var Game = Container.expand(function () { var self = Container.call(this); self.windBar = null; self.sixthFingerBar = null; self.powerBar = self.addChild(new PowerBar()); self.powerBar.isShowing = false; self.powerBar.hide(); self.powerBar.show = function () { self.powerBar.visible = true; self.powerBar.isShowing = true; }; self.powerBar.hide = function () { self.powerBar.visible = false; self.powerBar.isShowing = false; }; LK.stageContainer.setBackgroundColor(0x008080); var lake = self.addChild(new Lake()); lake.x = 2048 / 2; lake.y = 2732 / 2; var hand = self.addChild(new Hand()); self.powerBar = self.addChild(new PowerBar()); var stone = self.addChild(new Stone()); stone.x = hand.x; stone.y = hand.y; self.scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.topCenter.addChild(self.scoreTxt); var isGameOver = false; var ricochets = 0; var restartButton = self.addChild(new RestartButton()); restartButton.visible = false; LK.on('tick', function () { if (!stone.isLaunched) {} stone.move(lake); if (stone.isLaunched) { var distance = Math.sqrt(Math.pow(stone.x - hand.x, 2) + Math.pow(stone.y - hand.y, 2)); LK.setScore(Math.floor(distance)); self.scoreTxt.setText('Score: ' + LK.getScore()); } }); var clickCount = 0; stage.on('down', function (obj) { clickCount++; if (clickCount === 2) { self.windBar = self.addChild(new WindBar()); self.windBar.show(); } else if (clickCount === 3) { self.sixthFingerBar = self.addChild(new SixthFingerBar()); self.sixthFingerBar.show(); } if (!stone.isLaunched && self.powerBar && self.powerBar.isShowing === false && clickCount === 1) { self.powerBar.show(); } else if (!stone.isLaunched && self.powerBar.isShowing && clickCount === 4) { stone.launch(hand, self.powerBar.progress, self.windBar ? self.windBar.strength : 50, self.sixthFingerBar ? self.sixthFingerBar.progress : 50); self.powerBar.hide(); } }); stage.on('move', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); hand.move({ x: pos.x }, stone); }); });
===================================================================
--- original.js
+++ change.js
@@ -251,9 +251,13 @@
restartButton.visible = false;
LK.on('tick', function () {
if (!stone.isLaunched) {}
stone.move(lake);
- self.scoreTxt.setText('Score: ' + LK.getScore());
+ if (stone.isLaunched) {
+ var distance = Math.sqrt(Math.pow(stone.x - hand.x, 2) + Math.pow(stone.y - hand.y, 2));
+ LK.setScore(Math.floor(distance));
+ self.scoreTxt.setText('Score: ' + LK.getScore());
+ }
});
var clickCount = 0;
stage.on('down', function (obj) {
clickCount++;
A nice lake Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A hand Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A small stone Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A power bar Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A power bar Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A restart button Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.