Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoShaman()
- start=os.time()
- _Vento = math.random(1,4)
- vento = os.time();
- vivos=0
- 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,250 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(0,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, 2950, {type=14,width=100,miceCollision=true,friction=0.3,restitution=0.2})
- end
- data={}
- function eventChatMessage(name,cmd)
- if cmd == "!help" or cmd == "!ajuda" then
- tfm.exec.chatMessage("<VP>●</VP> <CE>O objetivo do jogo é subir até o topo do mapa para vencer, mas para facilitar um pouco apertando <B>Espaço</B> você da um pulo duplo de acordo com a força indicada na mini-interface abaixo á esquerda, legenda:",name)
- tfm.exec.chatMessage("<font color='#00BFFF'>▲</font> - Força de pulo: Fraca ",name)
- tfm.exec.chatMessage("<font color='#FFCC00'>▲</font> - Força de pulo: Média ",name)
- tfm.exec.chatMessage("<font color='#00FF00'>▲</font> - Força de pulo: Forte ",name)
- tfm.exec.chatMessage("<font color='#FF0000'>▲</font> - Força de pulo: Muito Forte ",name)
- tfm.exec.chatMessage("<font color='#2C2C2C'>▲</font> - Força de pulo: Null ",name)
- tfm.exec.chatMessage(" <font color='#FF0000'>♥</font> - Coração: Ainda não perdido ",name)
- tfm.exec.chatMessage(" <font color='#8B0000'>♥</font> - Coração: Perdido ",name)
- end
- end
- function eventNewPlayer(name)
- if not data[name] then
- data[name]={
- fly=os.time(),
- maxLife=2,
- life=2
- }
- end
- tfm.exec.chatMessage("<VP>●</VP> <J>Olá "..name.." bem-vindo(a) ao <I>Sky</I>.</J></B>",name)
- tfm.exec.chatMessage("<VP>●</VP> <ROSE>Minigame em desenvolvimento, Versão alpha: <B><VI>0.10</VI></B>, Criado por: <VI><B>Contistente</B></VI></ROSE>",name)
- if tfm.get.room.playerList[name].isDead then
- data[name].life = 0
- end
- system.bindKeyboard(name,32,true)
- end
- function eventPlayerDied(name)
- if data[name].life > 0 then
- if start < os.time()-3000 then
- data[name].life=data[name].life-1;
- end
- tfm.exec.respawnPlayer(name)
- else
- tfm.exec.chatMessage("Você perdeu todos seus corações e não pode mais reviver neste mapa.",name)
- vivos=vivos-1;
- end
- end
- function eventLoop(t,r)
- 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=""
- for i=1,data[name].maxLife do
- if data[name].life < i then
- s=s.."<font color='#8B0000' size='15'><B>♥</font>"
- else
- s=s.."<font color='#FF0000' size='15'><B>♥</font>"
- end
- end
- return s
- end
- function eventNewGame()
- vivos=0
- tfm.exec.setGameTime(220)
- start=os.time()
- for i in pairs(tfm.get.room.playerList) do
- vivos=vivos+1;
- data[i].life=2
- 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