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
|
-- -----------------------------------------------------------------
-- Init
-- -----------------------------------------------------------------
local function prog_init()
initModels()
sound_playMusic("music/rybky03.ogg")
local pokus = getRestartCount()
-- -------------------------------------------------------------
local function prog_init_room()
local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
if pokus == 1 then
room.uvod = 0
elseif random(100) < 80 then
room.uvod = 0
else
room.uvod = 1
end
room.hlaska = random(1000) + 500
room.oldwamp = WAmp
room.oldwper = WPer
room.mluveni = 0
room.nudise = 0
room.nepas = 0
return function()
if room.mluveni ~= 0 then
wamp = random(4) + 4
wper = random(4) + 1
else
wamp = room.oldwamp
wper = room.oldwper
end
if isReady(small) and isReady(big) and no_dialog() then
if room.hlaska > 0 then
room.hlaska = room.hlaska - 1
end
if room.uvod > 2 then
room.uvod = room.uvod - 1
end
if room.uvod == 0 then
if random(100) < 30 then
room.uvod = random(100) + 20
else
room.uvod = 1
end
if random(100) < 30 then
addv(random(20) + 5, "pz-v-zaskladanej")
else
adddel(random(20))
end
if random(100) < 40 then
addm(random(8) + 3, "pz-m-co")
addv(random(4), "pz-v-klice"..(random(2) + 1))
else
addv(random(8) + 3, "pz-v-co"..(random(2) + 1))
addm(random(4), "pz-m-spoje"..(random(3) + 1))
end
elseif room.uvod == 2 then
room.uvod = 1
addm(8, "pz-m-vylez")
addv(10, "pz-v-dat")
elseif room.hlaska == 0 then
room.hlaska = -1
addm(20, "pz-m-pocitace")
planDialogSet(random(20) + 30, "pz-x-pocitac", 5, room, "mluveni")
elseif room.nudise == 0 and small.pohyby >= small.trpelivost and big.Y <= 8 then
addv(20, "pz-v-hej")
addm(0, "pz-m-nech")
room.nudise = 1
elseif room.nepas == 0 and (k1.Y > 5 and k1.Y < 20 and k1.dir == dir_no or k2.Y > 5 and k2.Y < 20 and k2.dir == dir_no or k3.Y > 5 and k3.Y < 20 and k3.dir == dir_no) then
room.nepas = 1
addm(10, "pz-m-nepasuje")
end
end
end
end
-- -------------------------------------------------------------
local function prog_init_small()
local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
small.pohyby = 0
small.trpelivost = 300 + random(700)
return function()
if level_isNewRound() and small.dir ~= dir_no then
small.pohyby = small.pohyby + 1
end
end
end
-- --------------------
local update_table = {}
local subinit
subinit = prog_init_room()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_small()
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
|