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.anchor.set(0.5, 0); sixthFingerLabel.x = 1024; 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.anchor.set(0.5, 0); windLabel.x = 1024; 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.anchor.set(0.5, 0); powerLabel.x = 1024; 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 += self.launchPower * 50; } 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: "#00ff00" }); LK.gui.topCenter.addChild(self.scoreTxt); 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(LK.getScore().toString()); } }); 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); }); });
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.anchor.set(0.5, 0);
sixthFingerLabel.x = 1024;
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.anchor.set(0.5, 0);
windLabel.x = 1024;
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.anchor.set(0.5, 0);
powerLabel.x = 1024;
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 += self.launchPower * 50;
}
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: "#00ff00"
});
LK.gui.topCenter.addChild(self.scoreTxt);
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(LK.getScore().toString());
}
});
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);
});
});
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.