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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
-- -----------------------------------------------------------------
-- Init
-- -----------------------------------------------------------------
local function prog_init()
initModels()
sound_playMusic("music/kufrik.ogg")
local pokus = getRestartCount()
-- -------------------------------------------------------------
local function prog_init_room()
konik.afaze = -random(100)
local semafodp = 0;
local nakresleni = random(300)+500
local otocka = random(200)+300
local mrka = random(4)+8
local proc = 0
local funkcni = true
local zacatek=random(2)
local zelena=false;
return function()
if o.dir ~= dir_no then
if proc < 0 then proc=0
else proc = proc+1 end
end
if proc==15 then proc=proc+1 addm(5, "proc-m") end
if koral.dir ~= dir_no then
if proc > 0 then proc=0
else proc = proc-1 end
end
if proc==-15 then proc=proc-1 addv(5, "proc-v") end
if otocka == 0 then
if no_dialog() or vrsek.afaze~=0 then
if vrsek.afaze==23 then
vrsek.afaze=0
vrsek:updateAnim()
spodek.afaze=0
spodek:updateAnim()
dole.afaze=0
dole:updateAnim()
nahore.afaze=0
nahore:updateAnim()
f.afaze=0
f:updateAnim()
o.afaze=0
o:updateAnim()
otocka = random(200)+300
else
if vrsek.afaze==0 then
if random(2)==1 then
vrsek:planDialog(0, "nevi-b")
else
vrsek:planDialog(0, "nejlepsi-b")
end
end
vrsek.afaze=vrsek.afaze+1
vrsek:updateAnim()
spodek.afaze=spodek.afaze+1
spodek:updateAnim()
dole.afaze=dole.afaze+1
dole:updateAnim()
nahore.afaze=nahore.afaze+1
nahore:updateAnim()
f.afaze=f.afaze+1
f:updateAnim()
o.afaze=o.afaze+1
o:updateAnim()
end
else
otocka = otocka+20;
end
else
otocka = otocka-1
end
nakresleni=nakresleni-1
if nakresleni==0 and isReady(small) and isReady(big) then
if no_dialog() and zelena==false then
addv(0, "hybeme-v")
addm(0, "agenti-m")
addv(0, "podvodou-v")
addm(10, "mene-m")
addv(0, "kecas-v")
addm(0, "cely-m")
else
nakresleni=50
end
end
if zacatek==0 and no_dialog() then
addv(0, "vidis-v")
addm(0, "budova-m")
addv(0, "rozkladaci-v")
addm(0, "drzel-m")
zacatek=2
end
if obrryb.afaze == 11 then
obrryb.afaze = -1 end
obrryb.afaze = obrryb.afaze+1
obrryb:updateAnim()
if konik.afaze == 3 then
if mrka == 0 and isReady(small) and isReady(big) then
if no_dialog() and zelena==false then
addm(10, "mrka-m")
addv(0, "nemrka-v")
mrka=random(4)+1;
addm(0, "ted"..mrka.."-m")
addv(0, "nebyl-v")
konik.afaze = 0
konik:updateAnim()
switch(mrka){
[1] = function()
konik.afaze=-85
end,
[2] = function()
konik.afaze=-80
end,
[3] = function()
konik.afaze=-80
end,
[4] = function()
konik.afaze=-90
end,
}
mrka=-1
else
mrka=1
konik.afaze = 0
konik:updateAnim()
konik.afaze = -random(100)
mrka = mrka-1
end
else
konik.afaze = 0
konik:updateAnim()
konik.afaze = -random(100)
mrka = mrka-1
end
end
if konik.afaze >= 0 then
konik:updateAnim()
end
konik.afaze = konik.afaze+1
if isReady(small)==false and funkcni and isReady(big) then
funkcni=false
addv(5, "rozbil-v")
end
if funkcni then
if small.Y > semafor.Y+1 then
semafor.afaze=2
if zelena and no_dialog() and isReady(big) then
addv(5, "zelena-v")
zelena = false
end
elseif small.Y ==semafor.Y+1 then
semafor.afaze=1
elseif small.Y < semafor.Y+1 then
semafor.afaze=0
if zacatek == 1 and no_dialog and isReady(big) then
addv(0, "semafor-v")
addm(0, "nacekala-m")
zelena=true
zacatek=2
end
end
else
if semafodp == 0 then
semafor.afaze=1
semafodp = 5
else
semafodp = semafodp-1;
semafor.afaze=3
end
end
semafor:updateAnim()
end
end
-- --------------------
local update_table = {}
local subinit
subinit = prog_init_room()
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
|