1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
file_include('script/share/prog_border.lua')
-- -----------------------------------------------------------------
-- Init
-- -----------------------------------------------------------------
local function prog_init()
initModels()
sound_playMusic("music/rybky04.ogg")
local pokus = getRestartCount()
--NOTE: a final level
small:setGoal("goal_alive")
big:setGoal("goal_alive")
for key, item in pairs(getModelsTable()) do
if item:getH() == 2 and item:getW() == 2 then
item:setGoal("goal_out")
end
end
-- -------------------------------------------------------------
local function prog_init_room()
local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
room.uztovedi = 0
room.jestejeden = 0
room.uztobude = 0
room.tusili = 0
if pokus > 7 then
if odd(pokus) then
room.uvod = -1
room.pokr = 20 + random(20)
else
room.uvod = 20 + random(25)
room.pokr = -1
end
else
room.uvod = 15 + random(20)
room.pokr = 20 + random(50)
end
return function()
local remain = 0
for key, item in pairs(getModelsTable()) do
if item:getH() == 2 and item:getW() == 2 then
if item.X == aura.X and item.Y == aura.Y + 1 then
item:setAnim("default", 1)
if room.uztovedi < 3 and item ~= light then
room.uztovedi = 3
end
else
item:setAnim("default", 0)
end
if not item:isOut() then
remain = remain + 1
end
end
end
pom2 = 0
if no_dialog() and isReady(small) and isReady(big) then
if room.uvod > 0 then
room.uvod = room.uvod - 1
elseif room.uvod == 0 then
room.uvod = -1
pom2 = 1
elseif room.pokr > 0 then
room.pokr = room.pokr - 1
elseif room.pokr == 0 then
room.pokr = -1
pom2 = 3
elseif stdBorderReport() then
if room.uztovedi > 2 then
addm(8, "gr-m-vsechny1")
else
addm(10, "gr-m-svaty1")
addv(6, "gr-v-vsechny1")
if pokus < 2 or random(100) < 70 then
addm(8, "gr-m-jensvaty")
end
end
elseif room.tusili == 0 and room.uztovedi < 2 and random(1000) == 1 then
room.tusili = 1
pom2 = 2
elseif room.uztovedi == 3 and random(30) == 1 then
room.uztovedi = 4
pom2 = 5
elseif room.jestejeden == 0 and remain == 1 and random(30) == 1 then
room.jestejeden = 1
pom2 = 7
elseif room.uztobude == 0 and isIn(remain, {1, 2, 3}) and random(150) == 1 then
room.uztobude = 1
pom2 = 6
end
end
switch(pom2){
[1] = function()
addm(10, "gr-m-gral")
addv(8, "gr-v-jiste")
pom1 = random(2)
addm(8, "gr-m-zare"..pom1)
addv(8, "gr-v-nic"..pom1)
end,
[2] = function()
addv(10, "gr-v-tuseni")
addm(10, "gr-m-tuseni")
end,
[3] = function()
addm(10, "gr-m-svaty0")
addv(8, "gr-v-vsechny0")
end,
[4] = function()
end,
[5] = function()
addm(8, "gr-m-vsechny0")
end,
[6] = function()
addv(10, "gr-v-skoro0")
end,
[7] = function()
addv(10, "gr-v-skoro1")
end,
}
end
end
-- -------------------------------------------------------------
local function prog_init_light()
light:setAnim("default", 1)
return function()
if room.uztovedi == 0 then
if light.X ~= aura.X or light.Y ~= aura.Y + 1 then
room.uztovedi = 1
end
end
end
end
-- -------------------------------------------------------------
local function prog_init_aura()
return function()
if aura.afaze >= 11 then
aura.afaze = 0
else
aura.afaze = aura.afaze + 1
end
aura:updateAnim()
end
end
-- --------------------
local update_table = {}
local subinit
subinit = prog_init_room()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_light()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_aura()
if subinit then
table.insert(update_table, subinit)
end
return update_table
end
local update_table = prog_init()
-- -----------------------------------------------------------------
-- Update
-- -----------------------------------------------------------------
function prog_update()
for key, subupdate in pairs(update_table) do
subupdate()
end
end
|