Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Ported from javascript
- local particles = {}
- local numberOfSprites = 5
- local spawnCooldown = 0
- local gfx = {}
- for i=1, numberOfSprites do
- gfx[i] = Graphics.loadImage(i .. ".png")
- end
- local function sin(d)
- return math.sin(d*0.017453292519943)
- end
- function onDraw()
- --Red overlay:
- Graphics.glDraw{vertexCoords={0, 0, 0, 600, 800, 0, 800, 600}, color={1, 0, 0, 0.133}, primitive=Graphics.GL_TRIANGLE_STRIP, priority = 1}
- if spawnCooldown <= 0 then
- spawnCooldown = math.random(3)
- spawnParticle(math.random()*832 - 16, 600) --Up to 16px off either end of screen
- end
- Text.print(mem(0x00B250E2, FIELD_WORD),0,0) --Line to check if paused
- if true then
- for i,part in ipairs(particles) do
- if part ~= -1 then
- part.x = part.baseX + sin(part.timer*5)*40 --Wavy effect
- part.y = (part.y + 100) * (1 + 1/part.yV) - 100 --Converging effect
- part.timer = part.timer + 0.65
- if part.y < -32 then
- particles[i] = -1
- end
- Graphics.glDraw{vertexCoords={part.x, part.y, part.x + 6, part.y, part.x + 6, part.y + 6, part.x, part.y + 6}, texture=gfx[part.sprite], textureCoords={0, 0, 1, 0, 1, 1, 0, 1}, color={1,1,1,0.8}, primitive=Graphics.GL_TRIANGLE_FAN, priority = -98}
- --Graphics.drawImage(gfx[part.sprite], part.x, part.y)
- end
- end
- end
- spawnCooldown = spawnCooldown - 1
- end
- function spawnParticle(x, y)
- local obj = {x=x, y=y}
- obj.sprite = math.random(numberOfSprites)
- obj.xV = 0
- obj.yV = math.random(-110, -70)
- obj.baseX = x
- obj.timer = 0
- table.insert(particles, obj)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement