Android game development and design steps

Source: Internet
Author: User
Today, the number of mobile phones with Android OS is much larger than that with iPhone. It is reported that an average of 0.4 million Android devices are activated every day. However, iOS is still a more profitable and popular platform for developers. The reason is: Android does not have to spend money to buy apps. now there are more mobile phones running Android operating systems than iPhone. It is reported that an average of 0.4 million Android devices are activated every day. However, iOS is still a more profitable and popular platform for developers. The reason is: Android does not have to spend money to buy apps; many devices and app stores make the Android Market scattered.

1 Introduction to mobile game development

The essence of a game is to constantly display and update images on the screen, but not to update images randomly, but to control images based on program logic. A complete game requires a wide range of knowledge, such as the creativity, background, storyline, sound effects, style, type, speed, and model adaptation of the game. In addition, game development requires coordination and tacit cooperation of planning, artist, program, and test.

2. game framework design

First, we need a view class for displaying the game interface. then we need to build an entire game logic class to control which interface is displayed on the current screen, and even perform some logical processing on the interface. After creating and controlling the view display, you must enable a thread to update the view display interface in real time and refresh the view to make the game work.

3. map design

Generally, a map in the game is a complete big map composed of multiple small blocks, and the data that makes up these small blocks can generally be stored using a two-dimensional array, then, the program maps the small pieces of the map data to the screen in the fastest way to form a complete map. Of course, this data is not input from the keyboard one by one. generally, a programmer will create a map editor and click and save it in the map editor, or download some mature editors from the network, such as using mappy to generate a map, and then using the script language to write a program in what format should be maintained for mappy. Generally, a map consists of a 45-degree angle, a top-down angle, and a side view.

4. main character design

The main character in the game becomes "genie" here. of course, the genie covers a wide range, not only the main character, but also the npc and props. Since it is a genie, there must be many animations. an animation itself connects an image frame by frame and plays each frame cyclically. You can also use your own genie editor to edit the Genie, split the Genie into many parts, and then combine them to save a lot of space. The characteristics of the Genie class, each time only one image instead of multiple images can be used to fill the screen, there can be several frames, but only one display at a time.

5 Layer Manager

You only need to add all layers (including maps and protagonists) to the layer manager, set the position and size of the view, and call the paint method of the layer manager to draw the layer. The order of drawing is in the reverse order of adding. you can add and then draw to avoid the layers being overwritten and not displayed.

6 game sound effects

First, we divide the sound effects in the game into the following categories: background music, plot music, sound effects (Action sound effects, use of item sound effects, and auxiliary sound effects. The background music usually needs to be played all the time, while the plot music only needs to be played when the plot needs it, and the sound effect is a short and small section.

7 Game Archives

The game archive stores the progress and other information of the player's current game. when the player enters the game again, it can continue the game by reading the last archive.

(1) identify the data to be stored

First, in order to repeat the game's previous progress smoothly, you need to save some attributes of the protagonist (including location, life, attack, defense, and so on ), you also need to save some attributes of the current map (such as rows, columns, and the first layer), as well as the relevant content of the conversation, finally, you need to save the entire map data of the game (each layer) and the current music status.

(2). save data

Get the stored data-> package the data into properties-> write properties to the file.

(3). load data

Open the File-> load the file stream into properties-> use the properties. get method to get the data of the specified tag-> assign the data to the corresponding variables in the application.

When you exit the game, players are automatically saved no matter whether they are saved or not.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.