Thank you so much, I resized my image and it works perfectly now
I tried to add effects on my buttons when I click them, so I created a function to animate the buttons when they are clicked.
Here’s the code to animate the buttons:
[lua]doanim = function(obj) – global function to animate buttons
local obj = obj
transition.to(obj, { time = 100, xScale = 1.2, yScale = 1.2 })
transition.to(obj, { delay = 100, time = 300, xScale = 1, yScale = 1 })
end[/lua]
Here’s the code to handle when the button is touched:
[lua]local touchHelp = function(event)
local obj = event.target if event.phase == “ended” then doanim(obj) – animate button
audio.play(sounds.popsound) – play pop sound
storyboard.gotoScene(“help”, “fromBottom”, 300) – go to help.lua
end
end[/lua]
I added sound and animation for the clicked buttons and it works fine.
Now I want to add more effects to it but I am stuck. My buttons are made up of bubbles and I want to add a popped-bubble effect on to the buttons when they are clicked. I have an image file for a “splashed bubble” effect and I want to add this effect when the buttons are clicked.
I have seen someone doing it like this from one of the older forums but I still don’t get it
[lua]function bubble:Pop()
if(self.collision)then
self:removeEventListener(“collision”, self)
end
if(self.touch)then
self:removeEventListener(“touch”,self)
end local bubblePop = display.newImageRect(self.gfxGroup, “BubblePop.png”, 250, 250)
bubblePop.x = self.x
bubblePop.y = self.y
bubblePop.xScale = .01
bubblePop.yScale = .01
transition.to(bubblePop, {time=150, xScale = 1, yScale = 1, alpha = 0, onComplete = function()
display.remove(bubblePop)
bubblePop = nil
end}) display.remove(self)
self = nil
end[/lua]