Skip to content

Android puzzle game inspired by the classic 15-puzzle game that breaks up a picture into blocks and lets the user swap two blocks at a time to unscramble the picture. But unlike the classic game which swaps two adjacent blocks, this game lets swap any two blocks at a time.

Notifications You must be signed in to change notification settings

shoaibk/PicturePuzzle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PicturePuzzle

Android puzzle game inspired by the classic 15-puzzle game that breaks up a picture into blocks and lets the user swap two blocks at a time to unscramble the picture. But unlike the classic game which swaps two adjacent blocks, this game lets swap any two blocks at a time.

How It Works

The game uses a 4x3 grid of rectangular Imageview blocks as the main layout. At the beginning of the game, a picture is loaded, and broken up into 4x3 rectangular pieces as bitmaps. These bitmaps are then positioned randomly into the Imageviews, creating the initial view of the game.

Each of these bitmaps is contained within an ImageView, which have touch and drag listeners attached to it. The drag listeners keep track of the position of the ImageViews and at the end of each drag, compare the current position of the group of ImageViews with their respective original positions. When all the ImageViews are placed into their original positions, the puzzle is solved.

The user can drag these individual bitmap pieces around to swap them among each other. Of course the aim is to finish unscrambling the picture as quickly as possible. The main activity class of the game is contained in the class DragDropActivity.

About

Android puzzle game inspired by the classic 15-puzzle game that breaks up a picture into blocks and lets the user swap two blocks at a time to unscramble the picture. But unlike the classic game which swaps two adjacent blocks, this game lets swap any two blocks at a time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages