История изменений
Исправление LINUX-ORG-RU, (текущая версия) :
Я нашёл секретный файл у Ковальски. В нём находится симуляция плана о доставке рыбы. По секрету скажу что нужно дождаться десяти успехов. О результатах затраченой рыбы в симуляции плана, секретно доложить лично Кавальски! Или тут!
Запрещена эпилептикам!!!!
Скопировать в файл с именем main.lua
положить в пустой каталог и запустить из него команду love .
Далее внимательно наблюдать до конца!
local config = {
screen = { size = {x = 1280, y = 720} };
}
local stars = {};
local planet = {};
local fish = {};
local function draw_scape()
love.graphics.setBackgroundColor(0,0,0,0);
end
local function create_planet()
planet = {
pose ={
x = config.screen.size.x * 0.5;
y = config.screen.size.y * 0.5;
};
r_draw = config.screen.size.x * 0.25;
r_real = 6371000;
}
end
take_bear = 0;
take_space = 0;
local function create_fish()
fish = {
x = planet.pose.x;
y = 25;
speed = love.math.random(-20,20);
speed_y = 0;
}
end
local function create_stars()
for i=1, 100 do
stars[i] = {
x = love.math.random(config.screen.size.x);
y = love.math.random(config.screen.size.y);
r = love.math.random(4);
}
end
end
local function draw_planet()
love.graphics.setColor(0.3,0.7,1,1);
love.graphics.circle('fill',planet.pose.x,planet.pose.y,planet.r_draw);
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',planet.pose.x,90,planet.r_draw*0.5,50);
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',planet.pose.x,planet.pose.y*2-90,planet.r_draw*0.5,50);
love.graphics.setColor(0.3,0.7,1,0.2);
love.graphics.circle('fill',planet.pose.x,planet.pose.y,planet.r_draw+50);
end
local function draw_stars()
for i=1,#stars do
local r = math.random();
local g = math.random();
local b = math.random();
love.graphics.setColor(r,g,b,1);
love.graphics.circle('fill',stars[i].x,stars[i].y,stars[i].r);
end
end
local function draw_fish(x,y)
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',x,y,15,4);
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill',x+10,y,2,2);
love.graphics.setColor(1,0,0,1);
love.graphics.ellipse('fill',x,y,5,2,45);
love.graphics.setColor(1,0,0,1);
love.graphics.ellipse('fill',x-20,y,5,2,45);
end
local function update_fish(dt)
local gravity = -90.8;
function vec2_sub(v1,v2)return{x = v1.x - v2.x;y = v1.y - v2.y}end
function vec2_div(v1,i)return{x = v1.x / i;y = v1.y / i;}end
function vec2_length_sqrd(v) return v.x * v.x + v.y * v.y;end
function vec2_length(v) return math.sqrt(vec2_length_sqrd(v));end
function vec2_dist_sqrd(v1,v2) return (v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y);end
function vec2_normalize(v) local len = vec2_length(v);return vec2_div(v, len);end
local v1, v2 = {x = fish.x,y = fish.y}, {x=config.screen.size.x*0.5,y=config.screen.size.y*0.5};
local direction = vec2_normalize(vec2_sub(v1,v2));
fish.speed = fish.speed - (1*dt);
fish.x = fish.x + direction.x + fish.speed;
fish.speed_y = fish.speed_y - direction.y
fish.y = fish.y + fish.speed_y;
end
function love.keypressed()
create_fish();
end
function love.mousepressed()
create_fish();
end
function love.update(dt)
update_fish(dt)
check_fish();
end
function check_fish()
if fish.x > config.screen.size.x or
fish.y > config.screen.size.y or
fish.x < 0 or fish.y < 0 then
take_space = take_space+1;
create_fish();
return;
end
if fish.x > planet.pose.x-100 and fish.x < planet.pose.x + 100 and
fish.y > planet.pose.y-50+planet.r_draw and fish.y < planet.pose.y-50+planet.r_draw + 150 then
take_bear = take_bear + 1;
create_fish()
return;
end
end
local function draw_bear(x,y)
love.graphics.setColor(1,1,1,1);
love.graphics.circle('fill',x,y,10);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x-4,y,2);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x+4,y,2);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x,y-4,3);
love.graphics.setColor(1,1,1,1);
love.graphics.ellipse('fill', x-6, y-10, 3.5, 8)
love.graphics.ellipse('fill', x+6, y-10, 3.5, 8)
end
local function draw_penguin(x,y)
love.graphics.setColor(1,1,1,1);
love.graphics.circle('fill',x,y-10,4);
love.graphics.setColor(1,1,1,1);
love.graphics.ellipse('fill', x, y, 6, 10)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-4, y+12, 4, 2)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+4, y+12, 4, 2)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-4, y, 2, 8)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+4, y, 2, 8)
love.graphics.setColor(1,0.9,0,1);
love.graphics.ellipse('fill', x, y-7, 5, 3)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-2, y-9, 1, 1)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+2, y-9, 1, 1)
end
function love.load()
love.window.setMode(config.screen.size.x,config.screen.size.y);
end
create_stars();
create_planet();
create_fish();
function love.draw()
local r = 0;
if take_bear >= 10 then
r = love.math.random(5,-5);
planet.pose.x = planet.pose.x + r;
end
draw_scape();
draw_stars();
draw_planet();
draw_bear(planet.pose.x+r,planet.pose.y+planet.r_draw+r);
draw_bear(planet.pose.x+15+r,planet.pose.y+planet.r_draw-20+r);
draw_bear(planet.pose.x-25+r,planet.pose.y+planet.r_draw+10+r);
draw_bear(planet.pose.x+25+r,planet.pose.y+planet.r_draw+10+r);
draw_bear(planet.pose.x+45+r,planet.pose.y+planet.r_draw-10+r);
draw_penguin(planet.pose.x+25+r,50+r);
draw_penguin(planet.pose.x-25+r,55+r);
draw_penguin(planet.pose.x+40+r,35+r);
draw_penguin(planet.pose.x-40+r,45+r);
draw_penguin(planet.pose.x+r,50+r);
draw_fish(fish.x,fish.y);
love.graphics.setColor(1,1,1,1);
love.graphics.print("uletelo v kosmoss: "..take_space.." ribok",config.screen.size.x-250,10,r);
love.graphics.print("uletelo k mishkam: "..take_bear.. " ribok",100,10,r);
if take_bear >= 10 then
love.graphics.setColor(0,1,0,1);
love.graphics.print("URAAAA NAKOTMILI MISHEK!!!",planet.pose.x-200,planet.pose.y,0,2)
end
end
Исправление LINUX-ORG-RU, :
Я нашёл секретный файл у Ковальски. В нём находится симуляция плана о доставке рыбы. По секрету скажу что нужно дождаться десяти успехов. О результатах затраченой рыбы в симуляции плана, секретно доложить лично Кавальски! Или тут!
Скопировать в файл с именем main.lua
положить в пустой каталог и запустить из него команду love .
Далее внимательно наблюдать до конца!
local config = {
screen = { size = {x = 1280, y = 720} };
}
local stars = {};
local planet = {};
local fish = {};
local function draw_scape()
love.graphics.setBackgroundColor(0,0,0,0);
end
local function create_planet()
planet = {
pose ={
x = config.screen.size.x * 0.5;
y = config.screen.size.y * 0.5;
};
r_draw = config.screen.size.x * 0.25;
r_real = 6371000;
}
end
take_bear = 0;
take_space = 0;
local function create_fish()
fish = {
x = planet.pose.x;
y = 25;
speed = love.math.random(-20,20);
speed_y = 0;
}
end
local function create_stars()
for i=1, 100 do
stars[i] = {
x = love.math.random(config.screen.size.x);
y = love.math.random(config.screen.size.y);
r = love.math.random(4);
}
end
end
local function draw_planet()
love.graphics.setColor(0.3,0.7,1,1);
love.graphics.circle('fill',planet.pose.x,planet.pose.y,planet.r_draw);
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',planet.pose.x,90,planet.r_draw*0.5,50);
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',planet.pose.x,planet.pose.y*2-90,planet.r_draw*0.5,50);
love.graphics.setColor(0.3,0.7,1,0.2);
love.graphics.circle('fill',planet.pose.x,planet.pose.y,planet.r_draw+50);
end
local function draw_stars()
for i=1,#stars do
local r = math.random();
local g = math.random();
local b = math.random();
love.graphics.setColor(r,g,b,1);
love.graphics.circle('fill',stars[i].x,stars[i].y,stars[i].r);
end
end
local function draw_fish(x,y)
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',x,y,15,4);
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill',x+10,y,2,2);
love.graphics.setColor(1,0,0,1);
love.graphics.ellipse('fill',x,y,5,2,45);
love.graphics.setColor(1,0,0,1);
love.graphics.ellipse('fill',x-20,y,5,2,45);
end
local function update_fish(dt)
local gravity = -90.8;
function vec2_sub(v1,v2)return{x = v1.x - v2.x;y = v1.y - v2.y}end
function vec2_div(v1,i)return{x = v1.x / i;y = v1.y / i;}end
function vec2_length_sqrd(v) return v.x * v.x + v.y * v.y;end
function vec2_length(v) return math.sqrt(vec2_length_sqrd(v));end
function vec2_dist_sqrd(v1,v2) return (v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y);end
function vec2_normalize(v) local len = vec2_length(v);return vec2_div(v, len);end
local v1, v2 = {x = fish.x,y = fish.y}, {x=config.screen.size.x*0.5,y=config.screen.size.y*0.5};
local direction = vec2_normalize(vec2_sub(v1,v2));
fish.speed = fish.speed - (1*dt);
fish.x = fish.x + direction.x + fish.speed;
fish.speed_y = fish.speed_y - direction.y
fish.y = fish.y + fish.speed_y;
end
function love.keypressed()
create_fish();
end
function love.mousepressed()
create_fish();
end
function love.update(dt)
update_fish(dt)
check_fish();
end
function check_fish()
if fish.x > config.screen.size.x or
fish.y > config.screen.size.y or
fish.x < 0 or fish.y < 0 then
take_space = take_space+1;
create_fish();
return;
end
if fish.x > planet.pose.x-100 and fish.x < planet.pose.x + 100 and
fish.y > planet.pose.y-50+planet.r_draw and fish.y < planet.pose.y-50+planet.r_draw + 150 then
take_bear = take_bear + 1;
create_fish()
return;
end
end
local function draw_bear(x,y)
love.graphics.setColor(1,1,1,1);
love.graphics.circle('fill',x,y,10);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x-4,y,2);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x+4,y,2);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x,y-4,3);
love.graphics.setColor(1,1,1,1);
love.graphics.ellipse('fill', x-6, y-10, 3.5, 8)
love.graphics.ellipse('fill', x+6, y-10, 3.5, 8)
end
local function draw_penguin(x,y)
love.graphics.setColor(1,1,1,1);
love.graphics.circle('fill',x,y-10,4);
love.graphics.setColor(1,1,1,1);
love.graphics.ellipse('fill', x, y, 6, 10)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-4, y+12, 4, 2)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+4, y+12, 4, 2)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-4, y, 2, 8)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+4, y, 2, 8)
love.graphics.setColor(1,0.9,0,1);
love.graphics.ellipse('fill', x, y-7, 5, 3)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-2, y-9, 1, 1)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+2, y-9, 1, 1)
end
function love.load()
love.window.setMode(config.screen.size.x,config.screen.size.y);
end
create_stars();
create_planet();
create_fish();
function love.draw()
local r = 0;
if take_bear >= 10 then
r = love.math.random(5,-5);
planet.pose.x = planet.pose.x + r;
end
draw_scape();
draw_stars();
draw_planet();
draw_bear(planet.pose.x+r,planet.pose.y+planet.r_draw+r);
draw_bear(planet.pose.x+15+r,planet.pose.y+planet.r_draw-20+r);
draw_bear(planet.pose.x-25+r,planet.pose.y+planet.r_draw+10+r);
draw_bear(planet.pose.x+25+r,planet.pose.y+planet.r_draw+10+r);
draw_bear(planet.pose.x+45+r,planet.pose.y+planet.r_draw-10+r);
draw_penguin(planet.pose.x+25+r,50+r);
draw_penguin(planet.pose.x-25+r,55+r);
draw_penguin(planet.pose.x+40+r,35+r);
draw_penguin(planet.pose.x-40+r,45+r);
draw_penguin(planet.pose.x+r,50+r);
draw_fish(fish.x,fish.y);
love.graphics.setColor(1,1,1,1);
love.graphics.print("uletelo v kosmoss: "..take_space.." ribok",config.screen.size.x-250,10,r);
love.graphics.print("uletelo k mishkam: "..take_bear.. " ribok",100,10,r);
if take_bear >= 10 then
love.graphics.setColor(0,1,0,1);
love.graphics.print("URAAAA NAKOTMILI MISHEK!!!",planet.pose.x-200,planet.pose.y,0,2)
end
end
Исходная версия LINUX-ORG-RU, :
Я нашёл секретный файл у Ковальски. В нём находится симуляция плана о доставке рыбы. По секрету скажу что нужно дождаться десяти успехов. О результатах затраченой рыбы в симуляции плана, секретно доложить лично Кавальски! Или тут!
Скопировать в файл с именем main.lua
положить в пустой каталог и запустить из него команду love .
Далее внимательно наблюдать до конца!
local config = {
screen = { size = {x = 1280, y = 720} };
}
local stars = {};
local planet = {};
local fish = {};
local function draw_scape()
love.graphics.setBackgroundColor(0,0,0,0);
end
local function create_planet()
planet = {
pose ={
x = config.screen.size.x * 0.5;
y = config.screen.size.y * 0.5;
};
r_draw = config.screen.size.x * 0.25;
r_real = 6371000;
}
end
take_bear = 0;
take_space = 0;
local function create_fish()
fish = {
x = planet.pose.x;
y = 25;
speed = love.math.random(-20,20);
speed_y = 0;
}
end
local function create_stars()
for i=1, 100 do
stars[i] = {
x = love.math.random(config.screen.size.x);
y = love.math.random(config.screen.size.y);
r = love.math.random(4);
}
end
end
local function draw_planet()
love.graphics.setColor(0.3,0.7,1,1);
love.graphics.circle('fill',planet.pose.x,planet.pose.y,planet.r_draw);
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',planet.pose.x,90,planet.r_draw*0.5,50);
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',planet.pose.x,planet.pose.y*2-90,planet.r_draw*0.5,50);
love.graphics.setColor(0.3,0.7,1,0.2);
love.graphics.circle('fill',planet.pose.x,planet.pose.y,planet.r_draw+50);
end
local function draw_stars()
for i=1,#stars do
local r = math.random();
local g = math.random();
local b = math.random();
love.graphics.setColor(r,g,b,1);
love.graphics.circle('fill',stars[i].x,stars[i].y,stars[i].r);
end
end
local function draw_fish(x,y)
love.graphics.setColor(0.8,0.8,0.8,1);
love.graphics.ellipse('fill',x,y,15,4);
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill',x+10,y,2,2);
love.graphics.setColor(1,0,0,1);
love.graphics.ellipse('fill',x,y,5,2,45);
love.graphics.setColor(1,0,0,1);
love.graphics.ellipse('fill',x-20,y,5,2,45);
end
local function update_fish(dt)
local gravity = -90.8;
function vec2_sub(v1,v2)return{x = v1.x - v2.x;y = v1.y - v2.y}end
function vec2_div(v1,i)return{x = v1.x / i;y = v1.y / i;}end
function vec2_length_sqrd(v) return v.x * v.x + v.y * v.y;end
function vec2_length(v) return math.sqrt(vec2_length_sqrd(v));end
function vec2_dist_sqrd(v1,v2) return (v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y);end
function vec2_normalize(v) local len = vec2_length(v);return vec2_div(v, len);end
local v1, v2 = {x = fish.x,y = fish.y}, {x=config.screen.size.x*0.5,y=config.screen.size.y*0.5};
local direction = vec2_normalize(vec2_sub(v1,v2));
fish.speed = fish.speed - (1*dt);
fish.x = fish.x + direction.x + fish.speed;
fish.speed_y = fish.speed_y - direction.y
fish.y = fish.y + fish.speed_y;
end
function love.keypressed()
create_fish();
end
function love.mousepressed()
create_fish();
end
function love.update(dt)
update_fish(dt)
check_fish();
end
function check_fish()
if fish.x > config.screen.size.x or
fish.y > config.screen.size.y or
fish.x < 0 or fish.y < 0 then
take_space = take_space+1;
create_fish();
return;
end
if fish.x > planet.pose.x-100 and fish.x < planet.pose.x + 100 and
fish.y > planet.pose.y-50+planet.r_draw and fish.y < planet.pose.y-50+planet.r_draw + 150 then
take_bear = take_bear + 1;
create_fish()
return;
end
end
local function draw_bear(x,y)
love.graphics.setColor(1,1,1,1);
love.graphics.circle('fill',x,y,10);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x-4,y,2);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x+4,y,2);
love.graphics.setColor(0,0,0,1);
love.graphics.circle('fill',x,y-4,3);
love.graphics.setColor(1,1,1,1);
love.graphics.ellipse('fill', x-6, y-10, 3.5, 8)
love.graphics.ellipse('fill', x+6, y-10, 3.5, 8)
end
local function draw_penguin(x,y)
love.graphics.setColor(1,1,1,1);
love.graphics.circle('fill',x,y-10,4);
love.graphics.setColor(1,1,1,1);
love.graphics.ellipse('fill', x, y, 6, 10)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-4, y+12, 4, 2)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+4, y+12, 4, 2)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-4, y, 2, 8)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+4, y, 2, 8)
love.graphics.setColor(1,0.9,0,1);
love.graphics.ellipse('fill', x, y-7, 5, 3)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x-2, y-9, 1, 1)
love.graphics.setColor(0,0,0,1);
love.graphics.ellipse('fill', x+2, y-9, 1, 1)
end
function love.load()
love.window.setMode(config.screen.size.x,config.screen.size.y);
end
create_stars();
create_planet();
create_fish();
function love.draw()
local r = 0;
if take_bear >= 10 then
r = love.math.random(5,-5);
planet.pose.x = planet.pose.x + r;
end
draw_scape();
draw_stars();
draw_planet();
draw_bear(planet.pose.x+r,planet.pose.y+planet.r_draw+r);
draw_bear(planet.pose.x+15+r,planet.pose.y+planet.r_draw-20+r);
draw_bear(planet.pose.x-25+r,planet.pose.y+planet.r_draw+10+r);
draw_bear(planet.pose.x+25+r,planet.pose.y+planet.r_draw+10+r);
draw_bear(planet.pose.x+45+r,planet.pose.y+planet.r_draw-10+r);
draw_penguin(planet.pose.x+25+r,50+r);
draw_penguin(planet.pose.x-25+r,55+r);
draw_penguin(planet.pose.x+40+r,35+r);
draw_penguin(planet.pose.x-40+r,45+r);
draw_penguin(planet.pose.x+r,50+r);
draw_fish(fish.x,fish.y);
love.graphics.setColor(1,1,1,1);
love.graphics.print("uletelo v kosmoss: "..take_space.." ribok",config.screen.size.x-250,10,r);
love.graphics.print("uletelo k mishkam: "..take_bear.. " ribok",100,10,r);
if take_bear >= 10 then
love.graphics.setColor(0,1,0,1);
love.graphics.print("URAAAA NAKOTMILI MISHEK!!!",planet.pose.x-200,planet.pose.y,0,2)
end
end