Try this code;
[lua]–Touch Balloon 2 Function
local function touchBalloon2 (event)
event.target.currentFrame = 2
end
—Spawn Balloon 2
local function spawnBalloon2 (event)
ranX = math.random(40,300)
local balloon2 = sprite.newSprite( spriteSet2 )
balloon2.currentFrame = 1
balloon2.x = math.random(20,300)
balloon2.y = 800
balloon2:addEventListener(“tap”, touchBalloon2)
transition.to(balloon2, {time=4700, y=-50, onComplete = function() balloon2:removeSelf() end})
end
timer.performWithDelay(1000, spawnBalloon2, 5)[/lua]
That’s just for the touch event.
For the spawning, you have two functions for two different balloon types so you would change how fast they spawn by adjusting how fast the timer was.
eg;
timer.performWithDelay(1000, functionName, 10)
and
timer.performWithDelay(500, functionName, 20)
Would see those second balloons spawn twice as often as the first.
Peach
[import]uid: 52491 topic_id: 20660 reply_id: 82886[/import]