Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --feito para a tribo ASSASSINATION OF THE SURVIVOR
- --autoria de Preuclides#3383 rs
- --optimização
- local tfm_exec_addImage = tfm.exec.addImage
- local tfm_exec_addShamanObject = tfm.exec.addShamanObject
- local math_random = math.random
- local table_unpack = table.unpack
- local coroutine_resume = coroutine.resume
- local coroutine_yield = coroutine.yield
- --desativando ações automáticas do jogo
- do local disable = {'AutoShaman', 'AutoNewGame', 'AutoScore'}
- for i=1, #disable do
- tfm.exec['disable'..disable[i]]()
- end
- end
- --variáveis locais
- local jogadoresEmJogo = 0
- for k in next, tfm.get.room.playerList do
- jogadoresEmJogo = jogadoresEmJogo+1
- end
- tfm.exec.setGameTime(360)
- --funções importantes
- local gradient = function(targetPlayer, force, imagem, camada, opacity) --por sklag#2552, adiciona as imagens em modo degradê
- local y = 0
- local opacity = opacity or 1.16
- local numeroDeImagens = 0
- local imagem = imagem or '17948da3319.png'
- local camada = camada or '!'
- while opacity > force do
- y = y +1
- opacity = opacity-force
- numeroDeImagens = numeroDeImagens+1
- tfm_exec_addImage(imagem, camada..'1', 0, y, targetPlayer, 800, 1, nil, opacity)
- tfm_exec_addImage(imagem, camada..'1', 0, 400-y, targetPlayer, 800, 1, nil, opacity)
- end
- return numeroDeImagens
- end
- local ladoDaCN = function()
- local aleatorio = math_random(2)
- local x = ({20, 800-20})[aleatorio]
- local y = math_random(80, 280)
- local angulo
- if y < 220 then
- angulo = ({math_random(70, 110), math_random(70, 110)-180})[aleatorio]
- else
- angulo = ({math_random(100, 140), math_random(100, 140)-180})[aleatorio]
- end
- local velocidade = ({math_random(10, 20), math_random(10, 20)-30})[aleatorio]
- return {x, y, angulo, velocidade}
- end
- --coroutine do "loop" que gera as CNs
- local scriptDoGato = coroutine.create(function() -- ( objectType, xPosition, yPosition, angle, xSpeed, ySpeed, ghost, options )
- while true do
- if jogadoresEmJogo == 0 then
- tfm.exec.newGame('<C><P /><Z><S><S X="401" H="40" Y="380" T="0" P="0,0,0.3,0.2,0,0,0,0" L="800" /></S><D><P X="24" P="0,0" Y="34" T="41" /></D><O /></Z></C>')
- for k in next, tfm.get.room.playerList do
- jogadoresEmJogo = jogadoresEmJogo+1
- end
- end
- for i=1, math_random(3) do
- tfm_exec_addShamanObject(17, table_unpack(ladoDaCN()))
- end
- coroutine_yield()
- end
- end)
- eventNewPlayer = function()
- jogadoresEmJogo = jogadoresEmJogo+1
- end
- eventPlayerDied = function()
- jogadoresEmJogo = jogadoresEmJogo-1
- end
- eventPlayerLeft = function()
- jogadoresEmJogo = jogadoresEmJogo-1
- end
- --loop principal
- do
- local aCada1Segundo
- local tempoDeInicio = 0
- eventLoop = function()
- if tempoDeInicio < 10 then
- tempoDeInicio = tempoDeInicio+1
- return
- end
- if aCada1Segundo then
- aCada1Segundo = false
- return
- end
- if coroutine_resume(scriptDoGato) == false then
- gradient(nil, 0.008, '17948d9ecc2.png', ':', 0.98)
- coroutine_resume = function() return true end
- end
- aCada1Segundo = true
- end
- end
- --inicio do mapa
- do
- tfm.exec.newGame('<C><P /><Z><S><S X="401" H="40" Y="380" T="0" P="0,0,0.3,0.2,0,0,0,0" L="800" /></S><D><P X="24" P="0,0" Y="34" T="41" /></D><O /></Z></C>')
- --tfm.exec.newGame('<C><P /><Z><S><S X="401" H="40" Y="280" T="0" P="0,0,0.3,0.2,0,0,0,0" L="400" /></S><D><P X="24" P="0,0" Y="34" T="41" /></D><O /></Z></C>')
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement