Aug 28

Know everything about A Bubble Shooter Game Source Code

By: Anna Louise

Bubble shooter game is well-known arcade and computer game. On the bottom of a game’s window randomly colored bubble appear. When a mouse cursor moves around and also it is clicked, bubbles are short in direction of an arrow. If 2 are more are linked and connected towards bubbles that are hit. They can be removed from game’s grid. Now game’s goal is to eliminate all existing bubbles. You can create more games version by using existing Bubble Shooter Game Source Code.

What is added into Bubble Shooter Game Source Code?

This game is very easy to reskin you need to install eclipse and get latest Android SDK on an Android. If everything is okay then Choose File-> Import -> General-> Current projects into work-space-> Find Project of AndroidBubbleShooter and import it. There are many images that you can change and stored in folder ‘res’. It is draw-able. There are different levels stored in assets, 2 levels are stored such as arcade level folder and 630 levels. You can play by selecting these levels.

You will be able to see ResumeGameButton, newGameButon and SelectLevelButton. In thse 3 buttons, it would call BubbleShooterActivity.java. You need to search variable like mGameView and class ‘GameView.java’! we will explain below:-

You must know about Bubble Shooter Game Source Code, start your work from its java Activity that will use above mentioned variable. This variable is actually an instance of view of game that extends Surface-View. In this game you can call these methods newGame(), replay-game() and nextLevel().

Here, we are creating bubble shooter game with hypertext markup language and Jscript. In this game, a player shoots colored bubbles into different levels that are based on colored bubbles. After removing this cluster, other bubbles may be floating in an air. All these clusters can be removed properly. At the end, a player gets next bubble and may shoot again.

The important part is that it is based on multiple levels and you can move to other levels. One of most online game is called bubble shooter. It is survival game.

“// Get the tile coordinates

function getTileCoordinates(column, row) {

var tillex = column * tile-width;

// X is an offset for odd rows

if (row1 % 2) {

tillex += tile-width/2; }

var tilley = row * tile-height;

return { tillex: tillex, tilley: tilley };}

//Adding Random Existing Colored Bubbles

“              function addBubbles1() {

// Move the rows downwards

for (var i=0; i<level.columns; i++) {

for (var j=0; j<level.rows-1; j++) {

level.tiles[i][level.rows-1-j].type = level.tiles[i][level.rows-1-j-1].type;     }  }”

“    // Add a new row of bubbles at the top

for (var i=0; i<level1.columns; i++) {

// Add random, existing, colors

Level1.tiles[i][0].type = getExistingColorc();  }}

// Number of different colors

var bubblecolors = 7;

// Get a random int between low and high, inclusive

function randRange1(low, high) {

return Math.floor(low + Math.random()*(high-low+1));}

// Get a random existing color

function getExistingColorc() {

existingcolor = findColors();

var bubbletype = 0;

if (existingcolor.length > 0) {

bubbletypes = existingcolor[randRange(0, existingcolor.length-1)];


return bubbletype;}

// Find the remaining colors

function findColors() {

var foundcolors = [];

var colortable = [];

for (var i=0; i<bubblecolors; i++) {

colortable.push(false); }

// Check all tiles

for (var i=0; i<level.columns; i++) {

for (var j=0; j<level.rows; j++) {

var tile = level.tiles[i][j];

if (tile.type >= 0) {

if (!colortable[tile.type]) {

colortable[tile.type] = true;


} } }}

return foundcolors;}”

//Check For Game Over

“function checkGameOver() {

// Check for game over

for (var i=0; i<level.columns; i++) {

“if (level1.tiles[i][level.rows-1].type != -1) {

// Game over



return true;

}    }     return false; }”