2048 Puzzle Game Android Native Game Source code

  • Demo

Test your mind and skills. Let see how quick you can play 2048 game. All you need to do is add the two tiles with the same number. The two tiles with the same number will merge or add up. Think and strategize to get the highest score. So join the numbers and get to the 2048 tile! 

The aim of the player is to swipe Up, Down, Left and Right to move the tiles/Cards around the board. Matching Cards will merge together to create a card with their total. The game is won when the maximum card is reached. 

Change Package Id

The first thing you should change is the package name. So, in Android Studio, rename the package name from the AndroidManifest.xml file and after rename the 'com.dreambigger.twofourzeroeight' under src to your own package name ('com.<companyname>.<appname>'). Android Studio should automatically update all pointers to that package name.

TODO Tags

In the code you will find TODO tags. Make sure to check them out. They indicate the places that you usually need to change something, although in this app most of the things that would be changed are all in the strings.xml file.

Change Colors

Open Strings.xml. In the code search for the following snippet. Change the color codes, to change the respective colors.

<!-- Primary Colors -->
    <color name="black">#ff3E3433</color>
    <color name="red">#ffE27B66</color>
    <color name="trans_white">#33FFFFFF</color>
    <color name="trans_white_background">#ccFFFFFF</color>
    <color name="brown">#ffB7A98C</color>
    <color name="background_color">#ffDDD2B2</color>

 

Board Width and Hight

Open Strings.xml. In the code search for the following snippet. Just change the number 4 to any other number to change the cards to have on each side of the board.

<integer name="Board_width">4</integer>

Customising Cards

The following code, in strings.xml determines how many cards would be displayed and whether each card is an image or a number. In the example below card 1 is a number, while card 2 is an image (image_name is referring to 'res/drawable/image_name.png'). As you can see the first array, 'Card_text_or_image_name' should be filled with a number or an image name, the second array, 'Card_type' detarmines if a card is an image (put 1) or is a number (put 0). Finally, the last array, 'Card_color', determines what color is each card.

    <!-- CARDS -->
    <!-- input card name or image name from drawable folder -->
    <string-array name="Card_text_or_image_name">
        <item>2</item>
        <item>image_name</item>
    </string-array>
 
    <!-- Card type: 0: text, 1: image -->
    <integer-array name="Card_type">
        <item>0</item>
        <item>1</item>
    </integer-array>
 
    <!-- Card color: enter a color for each card -->
    <array name="Card_color">
        <item>#ffE3E3D5</item>
        <item>#ffE3E2B1</item>
    </array>

Editing Images

 

Most of the images have with them included the .ai file. So feel free to edit them as you like. Remember to keep the same image resolution before replaceing it with the one in Android Studio

 

 

Extra Information

Extra information are in documentation.

Customer Reviews
Write Your Own Review

Only registered users can write reviews. Please, log in or register

Got questions about the product? Ask it from the product owner.
* Login Required

Project In Mind? Message Us Now

Notify me on sale

Please enter your email below and we will notify you whenever this product is on sale.