Efficient bubble shooter app

Hey everybody, this is my first time posting. I’m programming a simple bubble shooter app in the classic style: if there are three balls touching of the same color when the shooter ball hits, all the balls connected of the same color disappear. I put all the target balls that I spawned into an array and gave them a color property. I have gotten the program to work using a TON of embedded “while” statements to check for balls of the same color, but the code block looks bulky and inefficient. I was wondering if anyone had a better way of accomplishing this. Also, is there a way to use an “if” statement to tell if a number divided by another number is an actual integer? Thanks to anyone who can help. [import]uid: 110526 topic_id: 27064 reply_id: 327064[/import]

as for your second question, look at this:

local c, d = math.modf (21.5)  
print ("int:"..c.." / fract:"..d)  

so math.modf returns each the integral and the fractional part of your number. If the fractional part is = 0 you have an integer.

-finefin [import]uid: 70635 topic_id: 27064 reply_id: 109898[/import]

Thanks finefin. I have used the modulus and the modulo operator in other languages but wasn’t sure it was the same in Lua. I greatly appreciate the help. [import]uid: 110526 topic_id: 27064 reply_id: 112732[/import]