黑马程序员技术交流社区
标题:
android小游戏海盗船3
[打印本页]
作者:
woshiku
时间:
2015-9-13 09:43
标题:
android小游戏海盗船3
package com.testshipboat;
import xieyan.ControlInterface;
import xieyan.DataInterface;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import com.data.Data;
public class MainScreen extends Activity implements OnClickListener{
private ImageButton bt;
private Button easy_mode;
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_screen);
context = MainScreen.this;
bt = (ImageButton)findViewById(R.id.game_start);
easy_mode = (Button)findViewById(R.id.easy_mode);
easy_mode.setVisibility(View.INVISIBLE);
bt.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch(arg0.getId()){
case R.id.game_start:
//进入游戏
Data.currentStage = 1;
DataInterface dataIn = new DataInterface();
//三条生命
dataIn.setLife(3);
dataIn.setScore(0);
Intent it = new Intent();
it.setClass(context, TestShip.class);
startActivity(it);
break;
}
}
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2