http://wikisend.com/download/126152/Impact.zip
Above is a link to an example of one of the drawing methods in an app I’m making. Click and drag the mouse to draw a line of little explosion thingies.
My question:
Is there a better way to do this? I’ve got like 8 of these, each with their own tables, index variables, and methods, and I can’t help but think I’m missing something. The code portion of the file is below in case you’re unable or too lazy to view my file (I don’t judge).
[blockcode]require “sprite”
local xx = 0
local yy = 0
local impacts = {}
local impactIndex = #impacts + 1
sheet8 = sprite.newSpriteSheet( “expSmallX.png”, 20, 20 )
local spriteSet8 = sprite.newSpriteSet(sheet8, 1, 7)
sprite.add( spriteSet8, “explode2”, 1, 7, 150, 1 )
local function justCut (self)
local child = self
child.parent:remove ( child )
self = nil
end
local impactDraw = function()
impacts[impactIndex] = sprite.newSprite( spriteSet8 )
impacts[impactIndex].x = xx
impacts[impactIndex].y = yy
impacts[impactIndex].myLabel = “impact”
impacts[impactIndex].rotation = math.random (359)
impacts[impactIndex]:prepare(“explode2”)
impacts[impactIndex]:play()
local ph = impacts[impactIndex]
local myclosure = function() return justCut( ph ) end
timer.performWithDelay(250, myclosure)
impactIndex = impactIndex + 1
end
local onTouch = function( event )
xx = event.x
yy = event.y
impactDraw()
end
Runtime:addEventListener( “touch”, onTouch )[/blockcode] [import]uid: 89724 topic_id: 16923 reply_id: 316923[/import]



(I say you two should settle it Hey Arnold style: giant Q-tips, pool of Jello, balance beam, first one swimming in semisolids has to surrender their impressiveness).
[import]uid: 52491 topic_id: 16923 reply_id: 64571[/import]