The libgdx used in this article is version 0.92, which may be different from the latest version. The full text is for reference only.
Previous articlesArticleThis article introduces the usage of some basic classes in the libgdx framework, and also introduces someSource codeBut if libgdx is used for actual development?
It is not enough to understand several classes. You also need to have a detailed and macro understanding of the framework.
1. Application Lifecycle
The game should be efficient and stable, especially for Android platforms. The current development is for mobile phones and tablets. It is important to manage resources efficiently.
Imagine a game with beautiful production and high playability that runs on your Android phone crashes once every 10 seconds. is a game with a card like a cartoon running?
Android generally does not care about resize (). We instantiate the required objects in create and draw them in render. The current flexible data can be maintained during pause. Dispose () Reimbursement object.
In resume (), the game is restored Based on the maintained data.
In fact, it is not responsible. Dispose () can be ignored. The Android system will automatically recycle some of them, and users will also be able to accept the temporary stagnation after exiting.
You can also use the CREATE () method to make it easier to enter a game or initialize a scenario.
However, you must take pause () and resume () seriously. Phone calls are the most common type of out-of-the-box interruption. No user prefers a phone call to make the recording or progress disappear.
2. Game Architecture
I have always wondered whether the architecture should be called. You can understand it as a game composition. A general framework for a game, regardless of its size or complexity.
Here, I will explain it a little.
The input is only a response from the user. You can click, drag, and so on.
The output is usually an image or sound or image, and there are files or other data (such as network storage) at that time ).
The input files are generally pictures and sounds, and the logic consists of mathematical logic and physical logic.
While libgdx is a box2d encapsulation for physical processing, which can meet general requirements. Some common structures and a small number of formulas are encapsulated in mathematics. However, you can develop your ownAlgorithm.
Libgdx can be used directly to process images, sounds, and other files.
3. Game container
The most primitive container is application.
Then, game manages several screens, such as game scenarios, point scenarios, help scenarios, and high-score rankings. In this scenario, there are several stages where actors are on the stage.
Conclusion:
1. The precautions for each cycle are basically obtained from my experience and are not clear and scientific.
2. Recently, I did not write much about the competition because I participated in the National College Students' E-Commerce "innovation, creativity, and entrepreneurship" challenge. The first prize and the best entrepreneurial award were finally completed on Saturday, and it was not in vain. Next, I will wait for the Information College of Southwest University of Finance and Economics to issue a prize and prepare for the final examination...