I. Origin
Some time ago, Li san recommended a five-party game on the iphone, which was quite interesting. Prepare for the next game. However, this game was not found on android. I decided to develop one by myself and learn about android by the way. It is said that it will be very popular in the future. Now it's almost done. Let's take a look at it.
Ii. Outline Design
1. Game page class diagram
GameActivity
?
GameController controllers → GameModel extends gamma MapModel extends MapFactory extends Helper
? |
GameView | _ ItemModel implements ItemFactory
GameContext, Utils, DBUtils
I just want to do it myself, so I didn't make any images. All the content was directly formatted through the array in * Model. The rotation of items is also done through the rotation of arrays.
2. Image migration
Menu → MapList → Game
?
Setting
3. Development difficulties
①. Set events based on the Model status. The state machine is useless, so the judgment conditions are messy.
Iii. Auxiliary Tools
1. Obtain the map of the given image
If it takes too much time to manually input various map images on the Internet, it will be converted into a small square and the color of the center of each square will be used for identification. Although some cannot be correctly identified, most of them are normal. If it's hard to identify, you can do it manually.
2. Solving a given MAP
It's just a waste of effort. Computers are good at doing this kind of thing. That is, the efficiency of the algorithm is not high. It takes 10 hours for all the maps. However, I am too lazy to improve it when I run it once.
Iv. Summary
1. I am familiar with the Android architecture.
? The animation is well designed and easy to use.
? I made the Game first. I drew my own View. At the beginning, I couldn't figure out why I had to make an Activity out of the way. When I made other images, I found there were several reasons:
① View can be extracted and used for Layout. In this way, you must find a place to write the event control code.
② When there are multiple pages, you need to manage them together in one place.
③ A common window and other activities are required.
2. Learn about the release process of Google market.
3. No test code is written during the development process, and some code will not be reconstructed at will.
4. I did not do any design before. I started directly after I thought about it. A lot of things were too hasty and I was too lazy to change them later. For example, if byte is used in MapModel and int is not used in Controller, the state machine is useless.
5. The initial and release of global resources are not well planned.
? Add a parent class of a common Activity to facilitate management.
? Global Resources should be uniformly initialized in the program, which is a bit messy this time.