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
|
-- -----------------------------------------------------------------
-- Init
-- -----------------------------------------------------------------
local function prog_init()
initModels()
sound_playMusic("music/rybky03.ogg")
local pokus = getRestartCount()
local roompole = createArray(2)
-- -------------------------------------------------------------
local function prog_init_room()
local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
if pokus <= 1 then
roompole[1] = 0
else
roompole[1] = roompole[1] + 1
end
room.uz = 30 + random(20)
return function()
if room.dir ~= dir_no then
roompole[1] = 0
end
if game_getCycles() == room.uz and isReady(small) and isReady(big) then
if roompole[1] > 4 then
roompole[1] = -1
addm(1, "zav-m-hrac")
addv(9, "zav-v-zachranit")
room.uz = room.uz + 222 + random(1111)
else
if roompole[1] > 0 then
roompole[1] = roompole[1] - 1
end
pom1 = random(pokus + 1)
if pom1 > 4 or roompole[1] == -1 then
pom1 = random(3)
end
switch(pom1){
[0] = function()
addv(1, "zav-v-sto")
if random(3) > 0 then
addv(6, "zav-v-trpyt")
end
if big.Y == big.YStart then
addm(9, "zav-m-pohnout")
end
end,
[1] = function()
addm(1, "zav-m-krasa")
addv(9, "zav-v-venku")
end,
[2] = function()
addv(1, "zav-v-zaval")
addm(9, "zav-m-hopskok")
end,
[3] = function()
addm(1, "zav-m-kameny")
addv(9, "zav-v-zeleny")
end,
[4] = function()
addv(1, "zav-v-restart")
addm(8, "zav-m-pravda")
end,
}
room.uz = room.uz + 666 + random(2222)
end
end
end
end
-- -------------------------------------------------------------
local function prog_init_drahokamy()
local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
local gems = {}
for pom1 = 3, 111 do
local gem = getModelsTable()[pom1]
gems[pom1 - 3] = gem
gem.glob = -random(100)
gem.afaze = random(6) * 4
gem:updateAnim()
end
return function()
for key, gem in pairs(gems) do
gem.glob = gem.glob + 1
if isIn(gem.glob, {1, 2, 3}) then
gem.afaze = gem.afaze + 1
elseif isIn(gem.glob, {4, 5, 6}) then
gem.afaze = gem.afaze - 1
elseif gem.glob == 7 then
gem.glob = -random(100) - 10
end
gem:updateAnim()
end
end
end
-- --------------------
local update_table = {}
local subinit
subinit = prog_init_room()
if subinit then
table.insert(update_table, subinit)
end
subinit = prog_init_drahokamy()
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
|