Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- GOOD MAPS
- -- #45732
- -- #73686
- -- #82767
- -- #37517
- -- #92978
- -- #67264
- -- #18358
- -- #48141
- -- #88658
- -- #30375
- -- #1948
- -- #39730
- -- #63367
- -- #76795
- -- #30632 (EDIZ 10)
- -- #33281 (EDIZ 10)
- -- HMM MAPS
- -- #43425
- -- SMALLER GROUNDS: (TEST BIG?)
- -- #46494 (10+ me + mak)
- -- #78962 (10+ me + mak)
- -- #74219 (10+ me + mak)
- -- #63839
- -- #21317
- -- #888
- -- #48740
- -- #69716 (10)
- -- #17908 (10+)
- function split(s,t) local r={}; for p in string.gmatch(s,"[^"..t.."]+") do table.insert(r,p); end;return r;end
- GROUNDS = 80
- function GenerateXML()
- local n = GROUNDS
- local xml = ""
- local r = 0
- local L = 40;
- local X, Y, Y1, Y2, H1, H2;
- local s
- local TT = { 11}
- local T = TT[math.random(table.getn(TT))]
- local R = {}
- local a
- local rst = 0
- local fr = 0
- local maplength = n * 200 + 400
- local gap = 160
- tfm.exec.chatMessage("<R>#" .. tostring(SEED) .. " ground:" .. tostring(T),"sharpiepoops")
- -- start xml, random bg, with spawn ground,
- local bg = 'D="'
- local fg = 'd="'
- for i = 0, maplength, 800 do
- bg = bg..string.format('x_transformice/x_maps/x_halloween2015/jardin-citrouilles.jpg,%d,%d;', i, 0)
- fg = fg..string.format('x_transformice/x_maps/x_halloween2015/jardin-citrouilles-fg.png,%d,%d;',i, 293)
- end
- bg = bg .. '"'
- s = string.format('<C><P replaceMe '..bg..' G="0, 30" Ca="" L="%d" defilante="0,0,0,1" /><Z><S><S X="40" Y="350" H="100" L="80" T="%d" P="0,0,9999,0,0,0,0,0" />', maplength, T)
- xml = xml .. s
- local oTag = ''
- for i = 0,n-1,1 do
- -- Pick a random number
- r = math.random(100)
- -- X value of this ground
- X = 300 + (i * 200)
- -- Upper ground:
- -- Height
- H1 = r + 100
- Y1 = H1 / 2
- -- Lower ground:
- H2 = 400 - (H1+100)
- Y2 = H1 + gap + H2/2
- -- hmm, nudge up
- Y1 = Y1 - 20
- Y2 = Y2 - 20
- -- nudge height to make it easier towards the start
- H1 = H1 - (n-i)
- H2 = H2 - (n-i)
- local bonus = string.format('<O C="6" X="%d" Y="%d" P="0" />',X,Y1 + H1/2 + (Y2 - H2/2 - Y1 - H1/2)/2)
- oTag = oTag .. bonus
- -- Generate angle, and add upper ground (NOT NEEDED ANYMORE)
- a = 180
- --s = string.format('<S T="%d" P="0,0,%d,%d,%d,0,0,0" X="%d" Y="%d" L="%d" H="%d" c="2"/>',T,fr,rst,a,X,Y1,math.floor(L/40)*40,H1)
- --xml = xml .. s
- fg = fg..string.format('x_transformice/x_maps/x_halloween2015/ronces'..math.random(1,2)..'.png,%d,%d;',X-25, Y1 + H1/2 - 407)
- -- add acid underneath
- s = string.format('<S T="%d" P="0,0,%d,%d,%d,0,0,0" X="%d" Y="%d" L="%d" H="%d" m=""/>',19,fr,rst,a,X,Y1,50,H1)
- xml = xml .. s
- -- Generate angle, and add lower ground
- a = 0
- -- Last ground, rest and angle 0
- --if i==n-1 then
- -- rst = 0
- -- a = 0
- -- T = 6
- -- fr = 0.3
- -- end
- fg = fg..string.format('x_transformice/x_maps/x_halloween2015/ronces'..math.random(1,2)..'.png,%d,%d;',X-25, Y2 - H2/2)
- -- s = string.format('<S T="%d" P="0,0,%d,%d,%d,0,0,0" X="%d" Y="%d" L="%d" H="%d" c="2"/>',T,fr,rst,a,X,Y2,math.floor(L/40)*40,H2)
- -- xml = xml .. s
- -- add acid underneath
- s = string.format('<S T="%d" P="0,0,%d,%d,%d,0,0,0" X="%d" Y="%d" L="%d" H="%d" m=""/>',19,fr,rst,a,X,Y2,50,H2)
- xml = xml .. s
- L = L + 1.5
- -- textarea width
- local taw = 12;
- if i+1>=10 then
- taw = 20
- end
- gap = gap - 1
- if gap < 120 then gap = 120 end
- --ui.addTextArea(100+i, tostring(i+1), nil, X-taw/2, 26, taw, 16, 0x010101, 0xffffff, 0.5, false)
- -- table.insert(R,r)
- end
- fg = fg..'" '
- xml = string.gsub(xml,'replaceMe',fg)
- xml = xml .. '</S><D>'
- -- mouse spawn
- xml = xml .. '<DS X="50" Y="300" />'
- -- holes and cheeses
- for i = 0,19,1 do
- xml = xml .. string.format('<T X="%d" Y="%d" />', maplength-100, 30 + i*20)
- end
- for i = 0,18,1 do
- xml = xml .. string.format('<F X="%d" Y="%d" />', maplength-100, 20 + i*21)
- end
- xml = xml .. '</D><O>'..oTag
- -- for i = 0,n-1,1 do
- -- X = 300 + (i * 200)
- -- Y =
- -- xml = xml .. s
- -- end
- xml = xml .. '</O></Z></C>'
- return xml
- end
- -- Finished counts
- FINISHED = {}
- MOVED = {}
- BONUSES = {}
- SEED = math.random(100000)
- math.randomseed(SEED)
- function Bind(p)
- tfm.exec.bindKeyboard(p,32, true,true)
- tfm.exec.bindKeyboard(p,37, true,true)
- tfm.exec.bindKeyboard(p,38, true,true)
- tfm.exec.bindKeyboard(p,39, true,true)
- tfm.exec.bindKeyboard(p,40, true,true)
- tfm.exec.bindKeyboard(p,1, true,true)
- tfm.exec.bindKeyboard(p,string.byte('A',1),true,true)
- tfm.exec.bindKeyboard(p,string.byte('S',1),true,true)
- tfm.exec.bindKeyboard(p,string.byte('D',1),true,true)
- tfm.exec.bindKeyboard(p,string.byte('Q',1),true,true)
- tfm.exec.bindKeyboard(p,string.byte('Z',1),true,true)
- system.bindMouse(p,true)
- end
- function SetPlayerSpeedX(p)
- tfm.exec.movePlayer(p,0,0,true,45,0,false)
- end
- function Reset(p)
- Bind(p)
- tfm.exec.setPlayerScore(p,FINISHED[p] * 50 + BONUSES[p])
- end
- function eventNewGame()
- local topPlayers = {}
- for p,_ in pairs(tfm.get.room.playerList) do
- topPlayers[#topPlayers + 1] = {p, FINISHED[p] * 50 + BONUSES[p]}
- Reset(p)
- tfm.exec.freezePlayer(p)
- FINISHED[p] = 0
- BONUSES[p] = 0
- tfm.exec.setPlayerScore(p, 0, false)
- end
- table.sort(topPlayers, function(a, b)
- return a[2] > b[2]
- end)
- if topPlayers[1][2] ~= 0 then
- tfm.exec.chatMessage('<i><R>Congratulations, winners!</r></i>')
- local colorTags = {"font color='#ffd700'", "font color='#c0c0c0'", "font color='#cd7f32'"}
- for i = 1, 3 do
- if topPlayers[i] then
- if topPlayers[i][2] ~= 0 then
- tfm.exec.chatMessage('<'..colorTags[i]..'>'..i..'. '..topPlayers[i][1]..' - '..topPlayers[i][2]..'</'..colorTags[i]..'>')
- tfm.exec.chatMessage("Ho ho ho! Congratulations, you've won the event map!\nMake sure you'll check your inbox the next few weeks for the cheese codes.\nWe wish you a merry Christmas and a Happy New Year!", topPlayers[i][1])
- end
- end
- end
- end
- tfm.exec.setGameTime(5 * 60,true)
- tfm.exec.setUIMapName('<R>Flappymouse: #' .. tostring(SEED))
- end
- function fly(p,x,y)
- tfm.exec.movePlayer(p,0,0,true,0,-100,false)
- end
- function eventMouse(p,x,y)
- fly(p,nil,nil)
- SetPlayerSpeedX(p)
- end
- local frozenEveryone = false
- function eventKeyboard(p,k,d,x,y)
- if frozenEveryone == false then
- for p, _ in pairs(tfm.get.room.playerList) do
- tfm.exec.freezePlayer(p)
- end
- frozenEveryone = true
- end
- if not tfm.get.room.playerList[p].isDead then
- if k==32 or k == 1 then
- fly(p,x,y)
- SetPlayerSpeedX(p)
- else
- if x < 300 then
- tfm.exec.chatMessage("<J>You can only press <VP>SPACE, CLICK or UP</vp><J>!",p)
- end
- end
- MOVED[p] = true;
- end
- end
- function eventLoop(t,r)
- if r < 3 then
- SEED = math.random(100000)
- tfm.exec.newGame(GenerateXML())
- end
- for p,P in pairs(tfm.get.room.playerList) do
- if P.isDead==false then
- if MOVED[p] == true then
- SetPlayerSpeedX(p)
- end
- if P.y<0 then
- tfm.exec.killPlayer(p)
- end
- tfm.exec.respawnPlayer(p)
- end
- end
- end
- function eventPlayerDied(p)
- tfm.exec.respawnPlayer(p)
- MOVED[p] = false
- end
- function eventPlayerWon(p)
- if not FINISHED[p] then FINISHED[p] = 1 else FINISHED[p] = FINISHED[p] + 1 end
- tfm.exec.chatMessage('<J>' .. p .. '<VP> finished the map!')
- tfm.exec.respawnPlayer(p)
- Reset(p)
- end
- system.disableChatCommandDisplay(nil, true)
- function eventNewPlayer(p)
- tfm.exec.setUIMapName('<R>Flappymouse: #' .. tostring(SEED))
- tfm.exec.chatMessage('<J>Welcome to <VP>Flappymouse - Christmas edition<J>! Write !help for instructions. Made by Sharpiepoops#0020, edited by Extremq#0000.', p)
- tfm.exec.chatMessage("<J>Fly using <VP>SPACE, CLICK or UP</VP>.", p)
- tfm.exec.respawnPlayer(p)
- tfm.exec.freezePlayer(p)
- FINISHED[p] = 0
- BONUSES[p] = 0
- Reset(p)
- end
- function eventPlayerRespawn(player)
- tfm.exec.freezePlayer(player)
- end
- function eventChatCommand(p,s)
- local a = split(s,' ')
- local cmd = 'command_' .. string.lower(a[1])
- if _G[cmd] then
- _G[cmd](p,a)
- end
- end
- function command_help(p,a)
- tfm.exec.chatMessage("<J>Type <VP>/watch YOUR NAME<J> if it's difficult to see your mouse!", p)
- end
- for p, _ in pairs(tfm.get.room.playerList) do
- eventNewPlayer(p)
- end
- function eventPlayerBonusGrabbed(p, bonusId)
- BONUSES[p] = BONUSES[p] + 1
- tfm.exec.setPlayerScore(p, FINISHED[p] * 50 + BONUSES[p])
- end
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.setRoomMaxPlayers(60)
- tfm.exec.newGame(GenerateXML())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement