[lua] --adding physics
local physics = require (“physics”);
physics.start();
physics.setGravity(-0.1 , -2.0) --Set to a negative value so the bubbles rise instead of fall
–Spawn bubbles at the bottom of the display
local function bubbleFloat()
local bubble = display.newCircle(0, 0, 22);
–Keeps the bubbles within the display and spawns them 35 pixels below the display
bubble.x = math.random(1, 768); bubble.y = (1024 + 35);
bubble.alpha = 0.6;
physics.addBody(bubble, {density = 0.1, bounce = 1.3, friction = 0.3, radius = 22});
print(" spawned bubble! ")
end
–Adding delay for function ‘bubbleFloat’
tmr = timer.performWithDelay(175, bubbleFloat, -0); [/lua]
Add your own bubble image, if necessary play around with the values until it feels right for your needs and you should be set.
-Saer [import]uid: 148623 topic_id: 37544 reply_id: 145746[/import]