Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoTimeLeft()
- tfm.exec.disableAutoScore()
- start=os.time()
- _Vento = math.random(1,4)
- vento = os.time();
- at=1
- vivos=0
- languages = {
- {
- welcome = "<VP>●</VP> <J>Olá %s bem-vindo(a) ao <I>Sky</I>.</J></B><BR><BL>Minigame em desenvolvimento versão alpha 0.12<BR>Minigame criado por: Contistente<BR>Ajudantes e Participantes:<BR>Lynezx e Fofinhoppp<BR>Dúvidas ou quer ver os comandos, digite !help</BL>",
- help = "<p align='center'><B><J><font size='15'>Como Jogar</font></J></B></p><BR><font size='12'><CE>O objetivo do jogo é chegar ao topo do mapa, todos os mapas do minigame são <B>Gerados aleatóriamente</B> pelo minigame, para não dificultar muito todos os jogadores tem 3 vidas e double jump apertando a tecla <B>Espaço</B>.</CE></font><BR><p align='center'><B><J><font size='15'>Comandos do Sky</font></J></B></p><br><BL><font size='12'><B>!lang [BR/E] - Define a linguagem do jogo apenas para você(Desativado).<BR>!help - Abre a janela de ajuda e comandos.</font>"
- }
- }
- textarea=ui.addTextArea
- function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss,active)
- --if not backgroundColor then backgroundColor=0x324650 end
- --if not borderColor then borderColor=0x000001 end
- if active then
- textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha,emboss)
- textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha,emboss)
- end
- textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
- end
- addPopup=ui.addPopup
- function ui.addPopup(id,tipo,texto,nome,x,y,largura,height,fixo)
- if tipo ~= 4 then
- addPopup(id,tipo,texto,nome,x,y,largura,height)
- else
- ui.addTextArea(id,texto,nome,x,y,largura,height,0x324650,0x324650,nil,true,true)
- ui.addTextArea(id+1,"<p align='center'><font size='12'><a href='event:close_popup'>Fechar</a></font></p>",nome,x+5,y+height-22,largura-10,18,0x3c5063,0x3c5063,nil,true,true)
- end
- end
- function traduction(name)
- langs = {}
- langs["br"]=1
- langs["en"]=1
- return languages[langs[data[name].lang]]
- end
- function sendNewMap()
- takeMul = function(x)
- return x-(x%5)
- end
- math.randomseed = 9
- xml = {}
- flipmode = math.random(0,2)
- if flipmode == 1 then
- tfm.exec.setAutoMapFlipMode(false)
- else
- tfm.exec.setAutoMapFlipMode()
- end
- xml.standard = "<C><P Ca='' H='3000' F=\""..(math.random(0,8)%6).."\" /><Z><S>%s</S><D>%s</D><O /></Z></C>"
- xml.grounds,xml.decorations = {},{}
- xml.S,xml.SET,xml.D = '<S c="1" L="%d" H="%d" X="%d" Y="%d" T="%d" P="0,0,%f,%f,%d,0,0,0" o="%d" />','<%s X="%d" Y="%d" />','<P P="0,0" X="%d" Y="%d" T="%d" />'
- grounds = {{0,1,4},{10,1},{12,13},{1,2},{4,1},{1,10},{10,9,2}}
- groundProperties = {{.3,.2},{0,.2},{0,1.2},{0,20},{20,.2},{.3,.2},{.3,.2},{.1,.2},{.3,.2},{0,0},{.3,0},{.05,.1},{.3,.2},{.3,.2},{.3,.2},{0,0}}
- decorations = {{0,4,5},{},{},{},{1,42,51},{1,2,4,12,18,20,32,42,46},{0,1,2,3,4,5,11,42},{7,8,9,10},{},{},{42,103,118},{51,106},{},{},{},{}}
- currentX,currentY = 0,0
- mapGrounds = grounds[math.random(#grounds)]
- for i = 1,245 do
- local ground = mapGrounds[i==1 and i or math.random(#mapGrounds)]
- local L = takeMul(ground~=13 and math.random(40,120) or math.random(20,40))
- local H = takeMul(math.random(20,35))
- if ground == 9 and math.random(10) < 6 then
- L,H = H,L
- end
- local X,Y
- repeat
- X = takeMul(math.random(-50,860) - L - (currentX/8))
- Y = takeMul(math.random(100,2500) + (currentY/4))
- until X > 0 and X < 800 and Y > 0 and Y < 3001
- currentX,currentY = X - X^.5,Y + Y^.5
- table.insert(xml.grounds,xml.S:format(L,H,X,Y,ground,groundProperties[ground+1][1],groundProperties[ground+1][2],i==1 and math.random(-10,10) or math.random(0,360),math.random(0,0xFFFFFF)))
- if math.random(22) < 3 then
- local dec = decorations[ground+1]
- table.insert(xml.decorations,xml.D:format(X - math.random(-((L/4)+1),((L/4)+1)),Y - (H/2),#dec>0 and dec[math.random(#dec)] or -1))
- end
- if i == 1 then
- for k,v in next,{"DS","T"} do
- table.insert(xml.decorations,xml.SET:format(v,400,2900 - (H/2)))
- end
- end
- end
- tfm.exec.newGame(xml.standard:format(table.concat(xml.grounds),table.concat(xml.decorations)))
- tfm.exec.addPhysicObject(0, 400, 2930, {type=math.random(0,14),width=100,miceCollision=true,friction=0.3,restitution=0.2})
- end
- data={}
- function eventTextAreaCallback(id,name,link)
- if link == "close_popup" then
- ui.removeTextArea(id,name)
- ui.removeTextArea(id-1,name)
- ui.removeTextArea(6969+id,name)
- ui.removeTextArea(6969+id-1,name)
- ui.removeTextArea(7979+id,name)
- ui.removeTextArea(7979+id-1,name)
- end
- end
- function eventChatMessage(name,cmd)
- if cmd == "!help" or cmd == "!ajuda" then
- lang = traduction(name)
- ui.addPopup(100,4,string.format(lang.help,name),name,200,100,400,200,true)
- end
- end
- function eventNewPlayer(name)
- if not data[name] then
- data[name]={
- fly=os.time(),
- maxLife=3,
- life=3,
- lang=""
- }
- end
- tfm.exec.setPlayerScore(name,0,false)
- data[name].lang = tfm.get.room.playerList[name].community
- if traduction(name) == nil then
- data[name].lang = "en"
- end
- lang = traduction(name)
- ui.addPopup(100,4,string.format(lang.welcome,name),name,200,100,400,120,true)
- tfm.exec.chatMessage(string.format(lang.welcome,name),name)
- if tfm.get.room.playerList[name].isDead then
- data[name].life = 0
- end
- system.bindKeyboard(name,32,true)
- end
- function eventPlayerDied(name)
- if start < os.time()-1000 then
- if data[name].life > 0 then
- data[name].life=data[name].life-1;
- if data[name].life > 0 then
- tfm.exec.respawnPlayer(name)
- end
- end
- if data[name].life == 0 then
- tfm.exec.chatMessage("Você perdeu todos seus corações e não pode mais reviver neste mapa.",name)
- vivos=vivos-1;
- end
- else
- tfm.exec.respawnPlayer(name)
- end
- end
- function eventLoop(t,r)
- if vivos <= 3 and at == 1 then
- at = 0
- tfm.exec.setGameTime(30,true)
- end
- str=""
- if vento < os.time()-6000 then
- _Vento = math.random(1,4)
- vento = os.time();
- end
- for i=1,_Vento do
- if i <= 1 then
- str=str.."<font color='#00BFFF'>▲</font>"
- elseif i <= 2 then
- str=str.."<font color='#FFCC00'>▲</font>"
- elseif i <= 3 then
- str=str.."<font color='#00FF00'>▲</font>"
- elseif i <= 4 then
- str=str.."<font color='#FF0000'>▲</font>"
- end
- end
- if _Vento == 3 then
- str = str.."<font color='#2C2C2C'>▲</font>"
- end
- if _Vento == 2 then
- str = str.."<font color='#2C2C2C'>▲▲</font>"
- end
- if _Vento == 1 then
- str = str.."<font color='#2C2C2C'>▲▲▲</font>"
- end
- if r < 1000 or vivos == 0 then
- sendNewMap()
- end
- for i,v in pairs(tfm.get.room.playerList) do
- if not v.isDead and v.y <= 300 then
- tfm.exec.giveCheese(i)
- tfm.exec.playerVictory(i)
- end
- ui.addTextArea(0,"",i,4.9,360,45,50,0x1C1C1C,0x1C1C1C,nil,true,true,true)
- ui.addTextArea(1,hearts(i),i,5,350,50,40,0,0,0,true)
- ui.addTextArea(2,"<B><font size='10'>"..str.."</font><BR><VP><B>"..(3000-v.y).."m",i,5,365,50,40,0,0,0,true)
- end
- end
- function hearts(name)
- s=""
- if data[name].life == data[name].maxLife then
- for i=1,data[name].life do
- s=s.."<font color='#FF0000' size='15'><B>♥</font>"
- end
- end
- if data[name].life < data[name].maxLife then
- for i=1,data[name].life do
- s=s.."<font color='#FF0000' size='15'><B>♥</font>"
- end
- m = data[name].maxLife-data[name].life
- for i=1,m do
- s=s.."<font color='#8B0000' size='15'><B>♥</font>"
- end
- end
- return s
- end
- function eventNewGame()
- vivos=0
- tfm.exec.setGameTime(220,true)
- start=os.time()
- for i in pairs(tfm.get.room.playerList) do
- vivos=vivos+1;
- data[i].life=3
- tfm.exec.respawnPlayer(i)
- end
- w=0
- at=1
- end
- function eventPlayerWon(name)
- w=w+1;
- if w <= 3 then
- if w == 3 then
- n=1
- elseif w == 2 then
- n=2
- elseif w == 1 then
- n=3
- end
- tfm.exec.setPlayerScore(name,n*3,true)
- end
- end
- function eventKeyboard(name,key,down,x,y)
- if key == 32 and data[name].fly < os.time()-1800 then
- v=_Vento*10
- tfm.exec.movePlayer(name,0,0,false,0,-v*3,true)
- data[name].fly=os.time();
- end
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- sendNewMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement