Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mapInfo = {}
- sparkles = {}
- xml = [[]]
- function eventNewGame()
- if tfm.get.room.xmlMapInfo then
- mapInfo = tfm.get.room.xmlMapInfo
- xml = mapInfo.xml
- set_sparkles(xml)
- end
- end
- function set_sparkles(xml)
- sparkles = {}
- local spk_str = xml:match("<O>(.-)</O>")
- for line in spk_str:gmatch("<O(.-)/>") do
- if line:match('SP="%d+"') then
- -- I had to make it seperated because the order of these can be different
- local x = line:match('X="(%d+)"')
- local y = line:match('Y="(%d+)"')
- local part = line:match('SP="(%d+)"')
- local typ = line:match('TY="(.-)"')
- local vel = line:match('VE="(%d+)"')
- local num = line:match('N="(%d+)"')
- sparkles[#sparkles+1] = {x=x, y=y, part=part, type=typ, num = num, vel=vel}
- end
- end
- end
- function show_animation(x, y, part, typ, num, vel)
- local x = tonumber(x) or 0
- local y = tonumber(y) or 0
- local num = tonumber(num) or 30
- local part = tonumber(part) or 0
- local vel = tonumber(vel) or 2
- if typ == "circle" then
- for l=1,num do
- local ang = l*(360/num)
- local x_vel = vel*math.cos(ang)
- local y_vel = vel*math.sin(ang)
- tfm.exec.displayParticle(part, x, y, x_vel, y_vel)
- end
- elseif typ == "square" then
- for l = -vel, vel, vel/6 do
- for o = -vel,vel, vel/6 do
- tfm.exec.displayParticle(part, x, y, l, o)
- end
- end
- else
- show_animation(x, y, part, "circle", nul, vel)
- end
- end
- function eventLoop(tp, tr)
- for k,v in pairs(sparkles) do
- show_animation(v.x, v.y, v.part, v.type, v.num, v.vel)
- end
- end
- tfm.exec.newGame("@6431320")
Advertisement
Add Comment
Please, Sign In to add comment