做了个拼图游戏

工作之余,对android颇有兴趣,只是武汉从事android的企业貌似不多,所有自学着玩一下,就坐个简单的拼图游戏,只当实验一下

简单的功能有 查找手机或sd卡的图片,等比缩放,分割,乱序,排列

还有再次点选择图片的时候,会记录图片所属目录(免得每次从根目录开始找)


[img]http://dl.iteye.com/upload/attachment/581392/5729eaae-d694-3b6e-82de-b125b7f79840.png[/img]

[img]http://dl.iteye.com/upload/attachment/581402/dcb1b56b-8e35-3445-a9be-9decbdfe4308.png[/img]

[img]http://dl.iteye.com/upload/attachment/581394/ca28b55d-fc4d-3f3d-a0b1-fded1dca1cac.png[/img]


[img]http://dl.iteye.com/upload/attachment/581396/8356754f-fd52-395b-9799-102e7509dceb.png[/img]

部分代码(其实我用的最土的办法,一个小图片记录两个坐标,一个是原始的,一个是随机的,最后判断每个小图片的 这两个坐标是否一致,如果都相同,则 Game Over)



public synchronized void check(){
boolean over = true;
for(BitmapView bitmapView : bitmapViewList){
if(bitmapView.getX() != bitmapView.getRandomX() || bitmapView.getY() != bitmapView.getRandomY()){
over = false;
isContinue = true;
isOver = false;
break;
}

}

if(over){
isContinue = false;
isOver = true;
Message msg = new Message();
Bundle bundle = new Bundle();
bundle.putBoolean("isOver", isOver);
msg.setData(bundle);
GameViewActivity.this.handler.sendMessage(msg);
}
}


class BitmapView{
Bitmap bitmap;
int x;
int y;
int randomX;
int randomY;
public BitmapView(Bitmap bitmap, int x, int y) {
super();
this.bitmap = bitmap;
this.x = x;
this.y = y;
}
public Bitmap getBitmap() {
return bitmap;
}
public void setBitmap(Bitmap bitmap) {
this.bitmap = bitmap;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getRandomX() {
return randomX;
}
public void setRandomX(int randomX) {
this.randomX = randomX;
}
public int getRandomY() {
return randomY;
}
public void setRandomY(int randomY) {
this.randomY = randomY;
}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值