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 179 180 181
|
-- -----------------------------------------------------------------
-- Init
-- -----------------------------------------------------------------
local function prog_init()
initModels()
sound_playMusic("music/rybky06.ogg")
local pokus = getRestartCount()
-- -------------------------------------------------------------
local function prog_init_room()
local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
if random(100) < 50 then
room.uvod = 0
else
room.uvod = 1
end
room.tuseni = 0
room.jo = 0
room.pocitadlo = random(500) + 500
return function()
if isReady(small) and isReady(big) and no_dialog() then
switch(room.uvod){
[0] = function()
addv(20 + random(30), "del-v-dve")
addm(random(5), "del-m-voda")
room.uvod = 2
end,
[1] = function()
addm(20 + random(30), "del-m-ci")
addv(random(5), "del-v-splet")
room.uvod = 2
end,
}
if room.pocitadlo < 1 and room.tuseni == 0 then
addv(random(5), "del-v-mec")
addm(random(5), "del-m-tus")
room.tuseni = 1
end
room.pocitadlo = room.pocitadlo - 1
elseif isReady(small) and big:isOut() and room.jo == 0 and (small.X < 2 or small.X > 25) then
small:setBusy(true)
switch(random(2)){
[0] = function()
addm(0, "del-m-jedn0")
end,
[1] = function()
addm(0, "del-m-jedn1")
end,
}
addm(random(5), "del-m-jedn2")
room.jo = 1
planBusy(small, false)
end
end
end
-- -------------------------------------------------------------
local function prog_init_delo1()
return function()
switch(math.mod(game_getCycles() + 1, 4)){
[0] = function()
delo1.afaze = 2
end,
[2] = function()
delo1.afaze = 2
end,
[1] = function()
delo1.afaze = 0
end,
[3] = function()
delo1.afaze = 1
end,
}
delo1:updateAnim()
end
end
-- -------------------------------------------------------------
local function prog_init_delo3()
return function()
switch(math.mod(game_getCycles(), 4)){
[0] = function()
delo3.afaze = 2
end,
[2] = function()
delo3.afaze = 2
end,
[1] = function()
delo3.afaze = 0
end,
[3] = function()
delo3.afaze = 1
end,
}
delo3:updateAnim()
end
end
-- -------------------------------------------------------------
local function prog_init_delo2()
return function()
switch(math.mod(game_getCycles() + 3, 4)){
[0] = function()
delo2.afaze = 2
end,
[2] = function()
delo2.afaze = 2
end,
[1] = function()
delo2.afaze = 0
end,
[3] = function()
delo2.afaze = 1
end,
}
delo2:updateAnim()
end
end
-- -------------------------------------------------------------
local function prog_init_delo4()
return function()
switch(math.mod(game_getCycles() + 1, 4)){
[0] = function()
delo4.afaze = 2
end,
[2] = function()
delo4.afaze = 2
end,
[1] = function()
delo4.afaze = 0
end,
[3] = function()
delo4.afaze = 1
end,
}
delo4:updateAnim()
end
end
-- --------------------
local update_table = {}
local subinit
subinit = prog_init_room()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_delo1()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_delo3()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_delo2()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_delo4()
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
|