-
Notifications
You must be signed in to change notification settings - Fork 18
Help for Developers
On this page, you can find some background information about how this app is implemented.
-
Element: This class extends the
android.support.v7.widget.AppCompatButton
class and represents a box on the game field. These elements contains different features like the presented value (number
) and the position of this value in the playing field (posX
,posY
). Because of the animation a distinction is made between the calculated value and the displayed value. Furthermore there are more features like the color of the box and the font size of the value. -
GameState: This class represents the game status for the different modi of the game, which implements the
java.io.Serializable
. Because of this, the GameState can be saved via streams. The GameState contains the last numbers on the game field, as well as the previous game status, which can be reached with the undo button in the game. Furthermore there is a variableundo
, which define, if it is possible to execut a undo. -
Gestures: This class handels the recognition of the user input. Therefore a mesurement of the touch input is made. With this information an interpretation of the movement is executed to define in wich direction the user wants the boxes to move in the game field (left, right, up, down).
-
GameStatistics: The current statistic in each modi is defined in this class. It contains the highes reached number, the amount of swipes (total and for each direction), playing time, highes score and the amount of used undo button. For saving this data in a file, the interface
java.io.Serializable
is implemented.
-
BaseActivity: This acitivity is a basic function if the SECUSO app. For example the menu navigation and the navigation bar are implemented in this class. All other activity succeed from this class.
-
BaseActivityWithoutNavBar: The same function are implemented as in the BaseActivity, but without the navigation bar.
-
MainActivity: The MainActivity is the activity from which the game in each modi is started. Therefore a ViewPager is used to depict pictures of the four modi. At the bottom of the activity there are two buttons, which start a new game (
START NEW GAME
) and continiue the previous game (CONTINIUE GAME
). TheCONTINIUE GAME
button is greyed out and is not selectable, if there is not previous played game in this modus available. -
GameActivity: This activity contains the entire game and draws the game field depending on the selected modus of the game and the screen size. Also the intent influences if a new game is generated or a previous game status is loaded. Therefore a two dimensional field named
elements
is filled with instances of the classElement
depending on the selected modus (4x4, 5x5, 6x6, 7x7). The function of the two buttonsrestart
andundo
are also implemented. With the help of the classGesture
the user imputs are recognized and the corresponding methode is retrieved. This methode contains the important game logic for this game. With loops the values of the elements will be added and the whole elements will be moved in the selected direction. After each move (only if something has been moved) a new element appears on the gamefield with the help of the methodeaddNumber()
. This new element is placed randomly on a free spot of the gamefield. If the activity is paused or stopped, the game status is saved in the GameState and the GameStatistics will be updated. -
StatsActivity: The game statistic of the four modi are loaded and shown in this activity. With a ViewPager the layouts of the different modi are loaded.
-
SettingsActivity: As the name suggests the settings for the app are located in this activity. Here you can change options like the color set of the game, activate or deactivate the animations and the screen locker.
-
SplashActivity: The goal of this activity is to start the tutorial in the case the app is started for the first time. After that the app should show the MainActivity.
-
HelpActivity: The HelpActivity is a standard activity provided by all SECUSO apps. In it are some FAQs with an adequate answere.
-
AboutActivity: This activity shows the important information of the app. Information like the developers, the version and the superior project, for which this app was implemented, are presented in this activity.
-
TutorialActivity: In this activity a ViewPager is filled with the four pages of the tutorial. The buttons at the bottom differ depending on the current position in the ViewPager.
Image caching library. Used for loading a Bitmap image inside the Activities MainActivity, StatsActivity and TutorialActivity (This is done to prevent a drawing cache error as a result of a too large size.)