Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 27/11/2016
- --Last update: 27/11/2016
- --[[ Notes:
- Does:
- Remake do LadrĂ£o de Queijos da vanilla
- ]]--
- for i,f in next,{"Shaman","NewGame","Score","TimeLeft"} do
- tfm.exec["disableAuto"..f]()
- end
- math.pythag = function(x1,y1,x2,y2,range)
- return ((x1-x2)^2+(y1-y2)^2<range^2)
- end
- system.xy = function(xml)
- local param = xml:match("<P (.-)/>")
- local hole = {param:match("thief.hole=\"(%d+),(%d+)\"")}
- local thief = {param:match("thief=\"(%d+),(%d+)\"")}
- return hole,thief
- end
- hole,thief = {0,0,0},{0,0,0,0}
- newMap = false
- eventNewGame = function()
- newMap = true
- tfm.exec.removeImage(hole[1])
- system.bindKeyboard(thief[1],32,true,false)
- local h,t = system.xy(tfm.get.room.xmlMapInfo.xml)
- hole = {tfm.exec.addImage("158abb69eb6.png","?1",h[1]-20.5,h[2]-15),table.unpack(h)}
- local thiefName,players = {"",-1e10},0
- for k,v in next,tfm.get.room.playerList do
- players = players + 1
- if v.score > thiefName[2] then
- thiefName = {k,v.score}
- end
- end
- thief = {thiefName[1],math.ceil((players/2)),3,0}
- tfm.exec.setNameColor(thief[1],0xBABD2F)
- tfm.exec.movePlayer(thief[1],t[1],t[2])
- tfm.exec.giveCheese(thief[1])
- system.bindKeyboard(thief[1],32,true,true)
- ui.setMapName("<J>#Thief <G>| <N>Thief : <V>"..thief[1])
- tfm.exec.setGameTime(80)
- end
- eventLoop = function(time)
- _G.time = (time/1000)
- if time >= 4 and newMap then
- for k,v in next,tfm.get.room.playerList do
- if k ~= thief[1] then
- if not v.hasCheese and not tfm.get.room.playerList[thief[1]].isDead then
- if math.pythag(v.x,v.y,tfm.get.room.playerList[thief[1]].x,tfm.get.room.playerList[thief[1]].y,25) then
- tfm.exec.giveCheese(k)
- thief[2] = thief[2] - 1
- if thief[2] <= 0 then
- tfm.exec.killPlayer(thief[1])
- tfm.exec.setPlayerScore(thief[1],0)
- tfm.exec.setGameTime(15)
- end
- end
- else
- if not v.isDead and math.pythag(v.x,v.y,hole[2],hole[3],30) then
- tfm.exec.playerVictory(k)
- tfm.exec.setPlayerScore(k,5,true)
- end
- end
- end
- end
- end
- end
- eventPlayerDied = function(n)
- if tfm.get.room.playerList[thief[1]].isDead and n ~= thief[1] then
- tfm.exec.setPlayerScore(n,1,true)
- else
- if tfm.get.room.playerList[n].score > 0 then
- tfm.exec.setPlayerScore(n,-1,true)
- end
- end
- end
- eventKeyboard = function(n,k,d,x,y)
- if time >= 4 and not tfm.get.room.playerList[thief[1]].isDead and n == thief[1] and thief[3] > 0 and os.time() > thief[4] then
- tfm.exec.explosion(x,y,50,60)
- tfm.exec.displayParticle(12,x,y)
- thief[3] = thief[3] - 1
- thief[4] = os.time() + 7000
- end
- end
- tfm.exec.newGame('<C><P thief="286,280" thief.hole="117,70" /><Z><S><S L="804" H="98" X="401" Y="434" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="59" H="92" X="286" Y="340" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="84" H="189" X="574" Y="291" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="72" H="249" X="118" Y="194" T="0" P="0,0,0.3,0.2,0,0,0,0" /></S><D><DS Y="372" X="116" /></D><O /></Z></C>')
Advertisement
Add Comment
Please, Sign In to add comment