Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Hass
- --Made in: 15/01/2020
- --Last update: 18/01/2020
- --[[ Notes:
- Does:
- Create a random map where the floors disappear quickly. Be the fastest!
- Keys:
- Space --> Speed
- ]]--
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoScore()
- for n in next,tfm.get.room.playerList do
- tfm.exec.setPlayerScore(n,0)
- end
- local generateMap=function()
- local xml = '<C><P L="25000" H="99999" /><Z><S>%s</S><D><DS Y="50" X="40" /></D><O /><L><JD P1="15000,-10000"P2="15001,10000"c="EBFB81,100"/><JD P1="25000,-10000"P2="25001,10000"c="D98AAD,100"/></L></Z></C>'
- for i = 1,1600 do
- xml = xml:format('<S L="40" H="40" X="'..(60*i-30 + math.random(-10,10))..'" Y="'..(100+(math.random(-i/3,i/3)))..'" v="'..(3000 + i*100)..'" c="1" T="'..math.random(0,12)..'" o="'..math.random(0x000000,0xFFFFFF)..'" P=",,,.1,'..math.random(0,360)..',,," />'..(i<1600 and '%s' or ''))
- end
- tfm.exec.newGame(xml)
- end
- velocity = 50
- key = 32
- mice={}
- eventNewPlayer=function(n) mice[n]={right=true}
- for _,k in next,{0,2,key} do
- system.bindKeyboard(n,k,true,true)
- end
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
- eventNewGame=function() table.foreach(tfm.get.room.playerList,function(n) mice[n]={right=true} end) end
- eventKeyboard=function(n,k)
- if k==key then
- tfm.exec.movePlayer(n,0,0,false,(mice[n].right and velocity or -velocity),0,true)
- end
- if k==0 then mice[n].right=false elseif k==2 then mice[n].right=true end
- end
- eventLoop=function(t)
- for n,v in next,tfm.get.room.playerList do
- if v.x >= 15000 then
- tfm.exec.giveCheese(n)
- end
- if v.x >= 25000 and tfm.get.room.current ~= "123" then
- tfm.exec.playerVictory(n)
- tfm.exec.setPlayerScore(n,100,true)
- tfm.exec.newGame(123)
- end
- end
- end
- generateMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement