var neuroplay = null;
var score = 0;
var game = false,
done = false;
var sec = 0;
var textForms = ["очко", "очка", "очков"];
var startTop = $("#sun").offset().top + 50;
var result = [];
var resPos = ["NaN", "#first", "#second", "#third", "#fourth", "#fifth"];
var count = 1; // В какой раз запускается игра (используется при заполнении таблицы результатов)
var countStars = 20 + Math.random() * 100;
addStars(countStars); //добавляем 20 - 100 звезд
// Игрок нажал кнопку "Начать"
$(".play").click(function() {
game = true; // Игра начинается
opacityChange("#time", 1);
opacityChange("#points", 1);
opacityChange("#results", 0);
sec = $("#seconds").val();
$("#seconds").val('');
$("#time").text("Времени осталось: " + sec);
// Запускаем таймер
var _Seconds = sec;
int = setInterval(function() {
if (_Seconds > 0) {
_Seconds -= 1;
$('#time').text("Времени осталось: " + _Seconds);
} else {
clearInterval(int);
game = false;
done = true; // Игра завершается
}
}, 1000);
$("#menu").animate({
opacity: 0
}, "linear");
})
function move(obj, conc, direction, sunTop) {
//Передвигает obj в направлении direction (вверх или вниз)
var normValue = 600;
var speed = conc / normValue;
var delta = direction + speed.toString() + "px";
$(obj).css({
top: delta
});
// Изменяем окружение в зависимости от высоты солнца
// Высота солнца в небе (%)
var sunPos = parseInt(sunTop) / (parseInt($("#sunsetSky").css('height')) / 100);
// Высота на экране (%)
var sunAbsolutePosition = parseInt(sunTop) / ($(window).height() / 100);
// Настраиваем прозрачность, учитывая полученные параметры
$("#sunsetSky").css('opacity', (Math.floor(sunPos) / 100));
$("#sunsetSun").css('opacity', (Math.floor(sunPos) / 100));
$("#nightGrass").css('opacity', (Math.floor(sunPos) / 100));
// Если солнце на высоте выше 40% относительно верхней части экрана
if (sunAbsolutePosition >= 40) {
// Высота, на которой...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.