DevStore首页 > DEV资源 > 源码下载 > 源码详情

Android应用源码之心小游戏-飞翔的圆(Flappy Bird)

 
董蒸上 | 2014-10-08 23:19    浏览量(4942)    评论(17)    收藏(2)
功能分类:休闲益智 支持平台:Android 运行环境:Eclipse
开发语言:Java 开发工具:Eclipse 源码大小:1.73MB
下载源码 787 人下载

源码简介

本项目是一个仿Flappy Bird的小游戏,只不过是把Flappy Bird里面的鸟替换成了简单的圆。感兴趣的朋友可以研究一下。本项目默认编码GBK。

源码截图

  • 运行截图
  • 运行截图
  • 运行截图
DevStore所有源码来自用户上传分享,版权问题及牵扯到商业纠纷均与DevStore无关。

源码片段

public class LoadingActivity extends Activity {
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		setContentView(R.layout.loading);

		final TextView gameStart = (TextView)findViewById(R.id.game_start);
		
		AdView adView = (AdView)findViewById(R.id.adView);
		adView.setAdListener(new AdListener() {
			
			@Override
			public void onReceiveAd(Ad arg0) {
				gameStart.setVisibility(View.VISIBLE);
			}
			
			@Override
			public void onPresentScreen(Ad arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onLeaveApplication(Ad arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onDismissScreen(Ad arg0) {
				// TODO Auto-generated method stub
				
			}
		});
		
		View gameMessage = findViewById(R.id.GameMessage);
		
		int[] data = getSettingData();
		
		TextView levelMessage = (TextView)findViewById(R.id.level_Message);
		
		levelMessage.setText("SCORE: "+data[0]+"\nBEST: "+data[1]);
		
		gameMessage.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				
				Intent intent = new Intent(LoadingActivity.this, GameBirdActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				
				startActivity(intent);
				
				finish();
			}
		});

	}
	
	private int[] getSettingData() {

		SharedPreferences gb_settings = getSharedPreferences(GameBirdActivity.GameBirdSettingsFile, 0);

		int last = gb_settings.getInt(GameBirdActivity.Settings_LevelLast, 0);
		int top = gb_settings.getInt(GameBirdActivity.Settings_LevelTop, 0);
		
		return new int[]{last, top};
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {

		if (keyCode == KeyEvent.KEYCODE_BACK) {

				try{
					GameBirdActivity.instance.finish();
				}catch(Exception e){}
				finish();
				System.exit(0);
				
			return true;
		}

		return super.onKeyDown(keyCode, event);
	}
}
  •   赞(0) 赞 +1 赞(0) 已赞
  •   收藏(2) 收藏 +1 已收藏 取消
  •   下载(787)
评论(17)
离梦

离梦 2017-04-11 15:33:07

先来表示下感谢,然后去看看代码
回复(0) 赞(0) 赞(1)
geguluo20

geguluo20 2015-12-04 15:31:50

下载要留名,请自称红领巾
回复(0) 赞(0) 赞(1)
wutiangreat

wutiangreat 2015-10-31 11:19:44

谢谢,学习了
回复(0) 赞(0) 赞(1)
无声须臾

无声须臾 2015-10-20 19:20:29

先表示下感谢,然后去看看代码
回复(0) 赞(0) 赞(1)
gk11010

gk11010 2015-02-28 10:34:18

先表示下感谢,然后去看看代码
回复(0) 赞(0) 赞(1)
  • 推荐
  • 审核
  • 收录
  • 获取活力值

源码上传作者

  • 60 能力值
  • 10 源码
  • 19 评测
  • 1 资料

热门源码