Discussion on Bubble Shooter template for Corona SDK

19 comments found.

is not support admob?


You can use AdMob or any ads network supported by Corona SDK.

To add AdMob to the game, please follow the example at http://docs.coronalabs.com/daily/plugin/ads-admob/

is this ready to submit app?


This is not a completed game. It only handles core mechanic of a bubble shooter game. To create a completed game, you will need to add support code on top of it (add sound, add more levels, and add database to keep player’s scores).

Hello. I see it says cross platform. How do I purchase the android version? also I see its not a complete game and I’m new to coding so does this come with documentation showing how to add sounds, additional levels and features etc? Thank you


There is no separated code for iOS and Android since you can use the same code to run on both OSes. In another word, when you download the code, you can run it on both Android and iOS.

This game was written using Corona SDK. Corona SDK has a very good online documentation. For example, documentation on adding sound can be found at http://docs.coronalabs.com/api/library/audio/play.html

If you have not used Corona SDK before, I would recommend you to try a few tutorials first. They can be found at http://coronalabs.com/resources/tutorials/getting-started-with-corona/

Adding level to Shooting Bubble is explained in the document that comes with the source code

Is this game ready to go for upload? I would just have to change some graphics and add in my own levels?

this seems like a lot of coding to get it working.

Hi, is it usable with Corona SDK Starter? (or does it need Pro or Enterprise plans?) Thanks in advance

Yes, you can use Starter edition for all my Corona templates. Thank you for looking.


jch Purchased

Just purchased and it does the job, the game base is here. Of course, some extra job will allow ads, inApp purchases and so on but $14 is a very reasonable price, writing the same from scratch would take hours and hours…. @uchat : a more detailed config.lua file could help beginners to display things correctly on different devices and would give a extra value to your template

Hi Jch,

Thank you for the purchase. The suggestion and feedback like this are very appreciated.

Happy coding :)

hi i purchased the code 3 days ago and i did not know that it need corona to make it work i downloaded corona sdk and outlaw both when i run app it freze

My email is in the document included in the package.

hi did u check the email and the error ?

The error message “module ‘composer’ not found” usually means that the Corona SDK you are using does not have the composer library shipped within it.

Composer library is available in Corona SDK version 2014.2393. What version of Corona SDK are you using? You can find the version number in Help->About Simulator menu

hi, I bought the template and I’m really satisfied of it. Just a question… is there a math reason for choosing 8 pieces for a row? Because I am trying to change it to 10 pieces in a row, changing all the measures, but sometimes, after bouncing left or right, the piece doesn’t find “the right place”. (I know that in the pdf you specify “8 pieces”, but I was experimenting :) )

Thank you very much in advance, JD

Hi, thank you for purchasing. “the right place” is calculated in function board:findClosestEmptyPiece(x, y) in Board.lua. It relies on row and the bubble dimensions. If you look at Row.lua and Piece.lua, there will be some constant numbers, these numbers are designed for the current configuration.

Also, in Board.lua, the initial values for oddEmptyRow and evenEmptyRow are for rows with 8 pieces.

Hi, Great template, Could you help me how to create new random bubble that it’s type have in the board. Not random 1 to 7. Thank you!

Hi, There is a function Board:findLowestRow() which can be used for this.

Basically you scan each row from lowest row to the top row that still visible on screen, collect all pieces in an array. Once done, randomly select one piece from that array and get a type of that piece to use to generate the bullet.

It could looks like this (note I have not test this code)

local lr = findLowestRow() local pieces = {} for i = lr.rowNumber,1,-1 do local r = row[i] if r:getAppearantY() < 0 then break end local ps = r:getPieces() for j=1,#ps do pieces[#pieces+1] = ps[j] end end local p = pieces[math.random(1, #pieces)] return p.typ

Since there are going to be only a couple rows visible at a time, this code should be fast enough.

If you want to be very efficient, you might want to track number of each bubble left on board using hash table. Hash keys would be type of bubble, values are number of bubble of that type that are available on board. You have to update this table when you add/remove bubbles. You only generate bullet of a given type if value of that type in table is more than 0.


I have seen you demo video on YouTube.There You have submitted the video of Demo.I cannot see the full features there.Is their any way i can see the full features running before i buy.

Second thing is can you modify the code if i ask you Third and important thing is can we chat. i want to buy the code but need to chat first Regards Haider

Hi, None of my code on codecanyon is not completed game. It is just a core of the game that the developers need to develop unique contents on top of it.

Hi,Ok i understand. can you develop that for for me if i ask you and how much you charge for it .https://play.google.com/store/apps/details?id=com.greenmango.game.bubbleshooter

https://play.google.com/store/apps/details?id=com.shootbubble.bubbledexlue want something like this.

Hi, My schedule is quite full at the moment and I won’t be able to handle another coding project for a while. However, you can visit freelancer sites like odesk.com to find Corona SDK developer. A quick search shows that the development cost is anywhere from $30 to more than $100 per hour.


Anyone successfully completed a full game with this template?

Anyone published game with this template? Will this work on all different screen sizes?

I see that you posted how to make it so the only bubbles the gun shoots (bullets) are the ones that are on the board not just random. My question is where would you place that code?


In that case, try change this line

local p = pieces[math.random(1, #pieces)]

to this if #piece == 0 then return math.random(1, 7) end local p = pieces[math.random(1, #pieces)]

This way, when there is no gem to choose from, it return random color.

Thanks for your help! The game is done and on the android app store here is the link: https://play.google.com/store/apps/details?id=com.happyhedgehog.HedgieEscape

P.S. I was wondering if there is a way to change the height and width of the game in the config file without completely messing up everything. As of right now tablets are too big for it to show properly and I need the size to change but when I edit the size everything is displaced.

The game was designed for specific image size. Some hardcoded values are in there that you will have to modify.

In function board:findClosestEmptyPiece(x, y) in Board.lua relies on row and the bubble dimensions. If you look at Row.lua and Piece.lua, there will be some constant numbers, these need to be changed.

Also, in Board.lua, the initial values for oddEmptyRow and evenEmptyRow are for rows with 8 pieces. Change them to match your design. Also, you might want to add more than 10 empty rows (see the loop just below evenEmptyRow = ..)

Hi, I recently bough the Bubble Shooter package from invite website and works perfectly, but I have to change the size of the balls for a few more small from the original 44×44 to size 28×28, also I Modify the matrix and also these variables Piece.IMAGE_HEIGHT = 28 Piece.WIDTH = 26 Piece.HEIGHT = 24 _offsetY = 28/2 Now I have problems when the balls collide, because the ball its looking for empty spaces which not pointed or jump balls. Even sometimes I get this error Attempt to index field ‘piece’ (a nil value) when it collides. I modified several variables but even still not working. Can you please help me , I would like to know which variables must be modified to makes the game work again?

Hi , I had figured and fixed the problem, thank u , BUT now Im trying to place on the board several winning pieces ( the animated ball going in circules ) , so the player must exploit to get more points, I changed and modified the callback function on board: replaceEmptyPiece I called in gameScene, everything works fine except for the peces ( animated ball ) when the collided, but just not free space where they found the winning piece, the board showing an empty space but when you pull different ball in the same space the animated ball was still counting counting points as animated ball still placing. What function should be called to free the space for other peaces ( balls ) that are thrown?

In another word, the winning pieces are animated and moving in circle?

By design, when the bullet hits non-winning pieces, it checks for closest empty slots and stick to that slot (see board:findClosestEmptyPiece). If there are pieces to be removed from board, the function board:pop() is called.

In your case, I think you need a similar function. Basically, you need to figuring out the row and column of the slot you want to free, then call row:setEmpty() to clear that slot, then remove the piece previously in that slot off the board.

Thanks for the help, actually I did call the function board: pop () with its walls and the problem was solved. I really appreciate the help and prompt response

Hi On your template of the Bubble shooter I got this error

<Warning>: Runtime error
   ?:0: attempt to index field 'piece' (a nil value)

when I call the funtion:

board:replaceEmptyPiece(targetSlot.piece.col, targetSlot.piece.row, targetSlot.typ,             targetSlot.from.x, targetSlot.from.y,             function(newPiece) in gameScene

Can you please tell me if I have to change or add something ?

from what part of the code that you call replaceEmptyPiece?

Also, make sure that piece in targetSlot.piece is valid

It calls the function in the function Update replaceEmptyPiece as it came in your template. about targetSlot.piece have a valor nil when they collide and the bullet fails to empty space. So I Have not changed these functions to be acquired template

Since you modified the size of the bubbles, you might need to also increase the number of empty row to cover the whole board. In Board.lua, almost at the end of file, you can see a for-loop

for i=1,10 do
    rows[#rows+1] =....     

Change 10 to, say 20 and test it if it solves the problem. This loop adds empty rows to fill the board. Note that 20 is just a guess, it depends on your board size and bubble size.

Hi Do you manage scoring ? Are you coding with composer + scenes management ? Did you implement pause / restart game (managing a call for example) Does the $70 fee let me publish and sell my game based on your code ?

Hi, This game is not completed and you will have to add support code to make a completed game. To make a completed game you will need to add more levels, write code to keep scores for each level, make a level selection scene, etc.

It use composer to manage scenes. It has its own game loop (which is a ‘enterFrame’ listener), so you can implement game pause by either stop listening to enterFrame event, of check for the state of the game in game loop.

For $70, you can use this code to create and publish as many games as you like. The regular option, $14, lets you use this code to publish one game only.

When a bullet is fired at the right (wrong) angle it will:

1: bounce off the wall and pass through pieces before it attaches

2: disappear off the top corner of the screen and the Y motion of the balls stops until another bullet is fired.

I got the same error as rdchicago did. I “fixed” it by adding this line in the gameScene.lua file

if targetSlot ~= nil then

if targetSlot.piece == nil then return; end;    -- ADDED, prevents error
state = STATE.update

Would be nice if you fixed the bullet issue!