资源描述:
《android平台俄罗斯方块游戏完整代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、整个游戏我分为10个java文件:先是俄罗斯方块的形状存储statefang.java,代码如下:packagecom.example.eluosifangkuai;publicclassstatefang{//方块的逻辑类publicstaticint[][][]state=newi整个游戏我分为10个java文件:先是俄罗斯方块的形状存储statefang.java,代码如下:packagecom.example.eluosifangkuai;publicclassstatefang{//方块的逻辑类publicstaticint[][][]state=n
2、ewint[][][]{ {//I {0,0,1,0},{0,0,1,0},{0,0,1,0},{0,0,1,0}},{//I1 {0,0,0,0},{0,0,0,0},{0,0,0,0},{1,1,1,1}},{//I2 {0,0,1,0},{0,0,1,0},{0,0,1,0},{0,0,1,0}},{//I3 {0,0,0,0},{0,0,0,0},{0,0,0,0},{1,1,1,1}},{//I4 {0,0,0,0},{0,0,0,0},{0,1,1,0},{0,1,1,0}},{//O5 {0,0,0,0},{0,0,0,0},{0,1,1,0},
3、{0,1,1,0}},{//O6 {0,0,0,0},{0,0,0,0},{0,1,1,0},{0,1,1,0}},{//O7 {0,0,0,0},{0,0,0,0},{0,1,1,0},{0,1,1,0}},{//O8 {0,0,0,0},{0,1,0,0},{0,1,0,0},{0,1,1,0}},{//L9 {0,0,0,0},{0,0,0,0},{1,1,1,0},{1,0,0,0}},{//L10 {0,0,0,0},{0,1,1,0},{0,0,1,0},{0,0,1,0}},{//L11 {0,0,0,0},{0,0,0,0},{0,0,1,0}
4、,{1,1,1,0}},{//L12 {0,0,0,0},{0,0,1,0},{0,0,1,0},{0,1,1,0}},{//J13 {0,0,0,0},{0,0,0,0},{1,0,0,0},{1,1,1,0}},{//J14 {0,0,0,0},{0,1,1,0},{0,1,0,0},{0,1,0,0}},{//J15 {0,0,0,0},{0,0,0,0},{1,1,1,0},{0,0,1,0}},{//J16 {0,0,0,0},{0,0,0,0},{0,1,0,0},{1,1,1,0}},{//T17 {0,0,0,0},{0,0,1,0},{0,1
5、,1,0},{0,0,1,0}},{//T18 {0,0,0,0},{0,0,0,0},{1,1,1,0},{0,1,0,0}},{//T19 {0,0,0,0},{1,0,0,0},{1,1,0,0},{1,0,0,0}},{//T20 {0,0,0,0},{0,0,0,0},{0,1,1,0},{1,1,0,0}},{//S21 {0,0,0,0},{0,1,0,0},{0,1,1,0},{0,0,1,0}},{//S22 {0,0,0,0},{0,0,0,0},{0,1,1,0},{1,1,0,0}},{//S23 {0,0,0,0},{0,1,0,0
6、},{0,1,1,0},{0,0,1,0}},{//Z24 {0,0,0,0},{0,0,0,0},{1,1,0,0},{0,1,1,0}},{//Z25 {0,0,0,0},{0,0,1,0},{0,1,1,0},{0,1,0,0}},{//Z26 {0,0,0,0},{0,0,0,0},{1,1,0,0},{0,1,1,0}},{//Z27 {0,0,0,0},{0,0,1,0},{0,1,1,0},{0,1,0,0}}//28 };}我们当然还要编写音乐播放类,资源播放类了等等。。。。。。我把所有的图片资源编写在一个类里面,叫做GameResources
7、.java,具体代码如下:packagecom.example.eluosifangkuai;importandroid.content.Context;importandroid.content.res.Resources;importandroid.graphics.Bitmap;importandroid.graphics.Canvas;importandroid.graphics.Bitmap.Config;importandroid.graphics.Paint;importandroid.graphics.drawable.Drawable;pub
8、licclassGameResourc