The jetboy game is an example game in the android SDK. It took several days to analyze it and compile the game for the future.CodeAccumulated experience. We have introduced snake games.
This game is relatively simple, and jetboy is relatively complicated. It mainly tells us how to use the jetplayer class. This exampleProgramWe will divide it into three sections (Framework Analysis and jetplayer Class Analysis)
Core code analysis
In this article, we mainly analyze its framework.
Shows the game interface:
First, we will introduce the composition of the game interface: asteroid (minor, meteorite), ship (spacecraft), beam (laser beam), and others are backgrounds.
How does this game play? The intermediate button is used to control the spacecraft to launch a laser, hit the meteorite score, and the spacecraft's position is consistent with the latest meteorite level.
How can I switch the portrait of the game interface? I believe every developer should know this (CTRL + F12 )!
First, we will analyze the structure of the class, as shown in:
The main types are as follows:
| Main Category |
Function Description |
| Jetboy |
Subclass of activity, game events |
| Jetview |
Game interface display |
| Jetthread |
Core Thread |
| Keygameevent |
One key event |
| Jetgameevent |
Events generated by a jet engine |
Then, the analysis program processes user operations:
Finally, we analyze the game running process:
Summary
The entire program looks complicated. I am also analyzing the android SDK, and then sort out the code and use the Rational Rose tool to analyze the code framework. Through the analysis tool, we can block the "complex" Code (Code details), and the entire framework can be clearly displayed in front of us.