《饥饿小鸟:简单安卓游戏开发解析》
1. 主活动概述
“饥饿小鸟” 游戏只有一个活动,即应用的主活动。这意味着开发者可以一次性消化该游戏的 Java 代码。为了更清晰地理解代码,下面先给出活动代码的大纲:
package com.allmycode.hungryburds;
public class MainActivity extends Activity
implements OnClickListener, AnimationListener {
// Declare fields
/* Activity methods */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Find layout elements
// Get the size of the device’s screen
// Set up SharedPreferences to record high scores
}
@Override
public void onResume() {
showABurd();
}
/* Game methods */
void showABurd() {
// Add a Burd in some random place
// At first, the Burd is invisible
超级会员免费看
订阅专栏 解锁全文
1万+

被折叠的 条评论
为什么被折叠?



