1 / 25
文档名称:

2048代码.doc

格式:doc   大小:196KB   页数:25页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

2048代码.doc

上传人:luyinyzhi 2017/2/18 文件大小:196 KB

下载得到文件列表

2048代码.doc

文档介绍

文档介绍:开始界面游戏的主界面是按钮图片,只是实现了界面的跳转, 此函数到让页面跳转游戏界面开始游戏, public class ZuomianActivity extends Activity{ protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(); }初始化方法,里面初始化了一些常量,字体颜色等 name="code" class="java">public MainView(Context context) { super(context); Resources resources =(); //Loading resources game =new MainGame(context, this); try {//Getting assets backgroundRectangle = (); lightUpRectangle = (); fadeRectangle = (); TEXT_WHITE =(); TEXT_BLACK =(); TEXT_BROWN =(); (()); Typeface font =((), "ClearSans-"); (font); (true); }catch (Exception e){("Error getting assets?"); }setOnTouchListener(new InputListener(this)); (); } 游戏界面游戏界面主要是在 中当前分数、最高分数、游戏区域、重新开始按钮、关卡选择按钮、帮助按钮,当跳转到游戏界面时就会调用并执行 函数来展示游戏界面。 protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(); }游戏界面的绘制***@Override protected void onSizeChanged(int width, int height, int oldw, int oldh) {(width, height, oldw, oldh); getLayout(width, height); createBitmapCells(); createBackgroundBitmap(width, height); createOverlays(); }.; import ; import ; import ; import ; import ; import ; public class MainGame {public static final int SPAWN_ANIMATION =-1; public static final int MOVE_ANIMATION =0