Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _B = {
- x = 40,
- y = 20,
- w = 132,
- h = 132,
- speed = 13,
- }
- local _D = {
- x = {},
- y = {},
- }
- local _S = {}
- function eventNewPlayer(name)
- _S[name] = {
- immortality = {time=3000,clock=os.time()}
- }
- end
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- function eventPlayerRespawn(name)
- _S[name].immortality = {time=3000,clock=os.time()}
- end
- function update(t)
- if t == 'start' then
- tfm.exec.addPhysicObject(1, _B.x, _B.y, {
- type = 12,
- width = _B.w,
- height = _B.h,
- color = 0x000000,
- })
- elseif t == 'move' then
- if #_D.x > 0 and #_D.y > 0 then
- if _B.x < _D.x[1] or _B.x > _D.x[1] and _B.y < _D.y[1] or _B.y > _D.y[1] then
- _B.x = math.random(10,790)
- _B.y = math.random(20,360)
- end
- end
- ui.addTextArea(0, "<p align='center'><font size='20'><bl><b>Pac-Man", nil, _B.x-_B.w/2+10, _B.y-_B.h/2+35, _B.w, _B.h, nil, nil, 50, true)
- tfm.exec.addPhysicObject(1, _B.x, _B.y, {
- type = 12,
- width = _B.w,
- height = _B.h,
- color = 0x000000,
- })
- end
- end
- function eventLoop(et, rt)
- _D.x = {}
- _D.y = {}
- ui.addTextArea(0, "<p align='center'><font size='20'><bl><b>Pac-Man", nil, _B.x-_B.w/2+10, _B.y-_B.h/2+35, _B.w, _B.h, nil, nil, 50, true)
- for k,v in next,tfm.get.room.playerList do
- if not v.isDead then
- table.insert(_D.x, math.random(10,790))
- table.insert(_D.y, math.random(20,360))
- end
- if not v.isDead and _B.x + _B.w/2+25 >= v.x and _B.x - _B.w/2-25 <= v.x and _B.y + _B.h/2+25 >= v.y and _B.y - _B.h/2-25 <= v.y then
- if _S[k].immortality.clock <= os.time()-_S[k].immortality.time then
- tfm.exec.killPlayer(k)
- end
- end
- end
- table.sort(_D.x, function(a,b)
- return (a - _B.x) > (b - _B.x)
- end)
- table.sort(_D.y, function(a,b)
- return (a - _B.y) > (b - _B.y)
- end)
- update('move')
- local et, rt = (et/1000), (rt/1000)
- if rt <= 0 then
- tfm.exec.newGame(mapas[math.random(#mapas)],nil)
- end
- end
- update('start')
- p={}
- function eventNewPlayer(name)
- p[name]={
- tempo = os.time()
- }
- system.bindKeyboard(name,32,true,true)
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- function eventKeyboard(name,key,down,x,y)
- if key == 32 and p[name].tempo < os.time()-1200 then
- tfm.exec.movePlayer(name, 0, 0, false, 0, -60, true)
- p[name].tempo = os.time();
- end
- end
- function eventNewGame()
- _B.x = 40
- _B.y = 20
- tfm.exec.setUIMapName("<b><r>Block<bv>Black")
- end
- function eventPlayerDied(name)
- local a = 0
- for k,v in next,tfm.get.room.playerList do
- if not v.isDead then
- a = a + 1
- end
- end
- if a < 1 then
- tfm.exec.newGame(mapas[math.random(#mapas)],nil)
- end
- end
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoNewGame()
- mapas = {"@7152091","@7173018","@7204773","@7206484","@7200714","@7245483","@7242570","@7242433","@7220692","@7250092","@7231239","@7230247"}
- tfm.exec.newGame(mapas[math.random(#mapas)],nil)
- function eventChatCommand(n,m)
- if(m:sub(0,3) == "msg") then
- if n == "Uhzinhooo" then
- tfm.exec.chatMessage("<VP><b>• [Uhzinhooo]</b> "..m:sub(5).."",nil) end end end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement