Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id=100
- def={}
- def[0]={width=1, height=1}
- def[1]={width=30, height=30}
- def[2]={width=60, height=60}
- def[3]={width=100, height=10}
- def[4]={width=200, height=10}
- def[6]={type=13, width=15, height=15}
- function eventLoop(time, remaining)
- if remaining<500 then
- local sx, sy=math.random(50, 1150), math.random(100, 400)
- local fx, fy=math.fmod(sx+math.random(600, 800), 1200), math.random(100, 400)
- tfm.exec.newGame(
- "<C><P L='1200'/><Z><S><S L='100' H='10' X='"..sx.."' Y='"..sy.."'/></S>"..
- "<D><T X='"..sx.."' Y='"..(sy-5).."'/><F X='"..fx.."' Y='"..fy.."'/></D><O/></Z></C>"
- )
- end
- end
- function eventNewGame()
- players=0
- for name, player in pairs(tfm.get.room.playerList) do
- players=players+1
- end
- end
- function eventPlayerLeft()
- players=players-1
- if players<=0 then
- eventLoop(0, 0)
- end
- end
- eventPlayerWon=eventPlayerLeft
- eventPlayerDied=eventPlayerLeft
- function eventSummoningEnd(name, type, x, y, angle, xs, ys, data, other)
- if def[type] then
- id=id+2
- local p=def[type]
- tfm.exec.removeObject(data.id)
- tfm.exec.addPhysicObject(id, x, y, {
- type=p.type or 0,
- width=p.width,
- height=p.height,
- foreground=not data.ghost,
- friction=0.2,
- restitution=0.1,
- angle=angle,
- color=0xffcc44,
- miceCollision=not data.ghost,
- groundCollision=true,
- dynamic=false
- })
- if data.ghost then
- angle=angle/180*math.pi
- local d=p.width/2-p.height/2
- local p1, p2=math.cos(angle)*d, math.sin(angle)*d
- if p1==p2 then p2=p2+1 end
- tfm.exec.addJoint(id+1, id, id, {
- type=0,
- point1=math.floor(x+p1)..","..math.floor(y+p2),
- point2=math.floor(x-p1)..","..math.floor(y-p2),
- line=p.height*(p.type==13 and 2 or 1),
- color=0x6A7495,
- alpha=0.6,
- foreground=true
- })
- end
- end
- end
- tfm.exec.disableAutoNewGame(true)
- eventLoop(0, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement