推箱子android源代码,android自定义view实现推箱子小游戏

本文实例为大家分享了android推箱子游戏的具体实现代码,供大家参考,具体内容如下

108b20e2faddafcee54f1af3ad4b4458.png

02b27bbde62ba736a1344247ca529354.png

自定义view:

package com.jisai.materialdesigndemo.tuixiangzhi;

import android.content.Context;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.graphics.Canvas;

import android.graphics.Color;

import android.graphics.Paint;

import android.graphics.Rect;

import android.util.AttributeSet;

import android.util.Log;

import android.widget.ImageView;

import com.jisai.materialdesigndemo.R;

import java.util.ArrayList;

public class View_tuixiangzhi extends ImageView {

ArrayList arrayList = new ArrayList<>();

int[][][] ccc =new int[300][15][15];

int kk=0;

Canvas canvas;

private int mWidth;

private int mHeight;

Boolean flag=false;

Bitmap bitmap0= BitmapFactory.decodeResource(getResources(), R.mipmap.qiang);

Bitmap bitmap1= BitmapFactory.decodeResource(getResources(),R.mipmap.kong);

Bitmap bitmap2= BitmapFactory.decodeResource(getResources(),R.mipmap.ren_1);

Bitmap bitmap3= BitmapFactory.decodeResource(getResources(),R.mipmap.xiang_1);

Bitmap bitmap4= BitmapFactory.decodeResource(getResources(),R.mipmap.xiang_2);

Bitmap bitmap5= BitmapFactory.decodeResource(getResources(),R.mipmap.hua);

Bitmap bitmap6= BitmapFactory.decodeResource(getResources(),R.mipmap.renandhua);

int [][]aaa= {//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,3,1,3,5,0,0,0,0,0},

{0,0,0,0,5,3,2,1,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,3,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,5,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

public interface PassLitener

{

void pass();

}

private PassLitener mPassLitener;

public void setPassLitener(PassLitener mPassLitener)

{

this.mPassLitener = mPassLitener;

}

public View_tuixiangzhi(Context context) {

super(context);

init("MyImageView(Context context)");

}

public View_tuixiangzhi(Context context, AttributeSet attrs) {

super(context, attrs);

init("MyImageView(Context context, AttributeSet attrs)");

}

public View_tuixiangzhi(Context context, AttributeSet attrs, int defStyle) {

super(context, attrs, defStyle);

init("MyImageView(Context context, AttributeSet attrs, int defStyle)");

}

private void init(String structName) {

}

@Override

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

int specSize = MeasureSpec.getSize(widthMeasureSpec);

mWidth = specSize;

specSize = MeasureSpec.getSize(heightMeasureSpec);

mHeight = specSize;

Log.e("宽高:","宽:"+mWidth+"高:"+mHeight);

setMeasuredDimension(mWidth, mHeight);

}

@Override

protected void onDraw(Canvas canvas) {

Log.e("onDraw:","onDraw");

this.canvas=canvas;

super.onDraw(canvas);

Paint p=new Paint();

p.setColor(Color.RED);

//canvas.drawRect(20,20,100,100,p);

//canvas.drawColor(Color.RED);

for(int i=0;i<15;i++){

for(int k=0;k<15;k++){

int x=aaa[i][k];

Rect rect = new Rect((mWidth/15)*k,(mWidth/15)*i,(mWidth/15)*(k+1),(mWidth/15)*(i+1));

switch (x){

case 0:

canvas.drawBitmap(bitmap0,null,rect,p);

break;

case 1:

canvas.drawBitmap(bitmap1,null,rect,p);

break;

case 2:

canvas.drawBitmap(bitmap2,null,rect,p);

break;

case 3:

canvas.drawBitmap(bitmap3,null,rect,p);

break;

case 4:

canvas.drawBitmap(bitmap4,null,rect,p);

break;

case 5:

canvas.drawBitmap(bitmap5,null,rect,p);

break;

case 6:

canvas.drawBitmap(bitmap6,null,rect,p);

break;

}

}

}

}

public void setaaa(int [][]xxx){

for(int i=0;i<15;i++){

for(int k=0;k<15;k++) {

aaa[i][k]=xxx[i][k];

}

}

kk=0;

arrayList.clear();

postInvalidate();

}

public void moveLeft(){

addBack();

flag=false;

for(int i=0;i<15;i++){

if (flag){

break;

}

for(int k=0;k<15;k++) {

if (flag){

break;

}

int x = aaa[i][k];

if(x==2|x==6){

Log.e("x",""+x+"i:"+i+"k:"+k);

switch ( aaa[i][k-1]){

case 0://左边是墙,不能移动

break;

case 1://左边是空,可以移动

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i][k-1]=2;

break;

case 3://左边是空箱子

if(aaa[i][k-2]==5){//箱子左边是花

aaa[i][k-2]=4;

aaa[i][k-1]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i][k-2]==1){//箱子左边是空

aaa[i][k-2]=3;

aaa[i][k-1]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 4://左边是满箱子

if(aaa[i][k-2]==5){//箱子左边是花

aaa[i][k-2]=4;

aaa[i][k-1]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i][k-2]==1){//箱子左边是空

aaa[i][k-2]=3;

aaa[i][k-1]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 5://左边是花

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i][k-1]=6;

break;

}

flag=true;

}

}

}

postInvalidate();

ifPass();

}

public void moveRight(){

addBack();

flag=false;

for(int i=0;i<15;i++){

if (flag){

break;

}

for(int k=0;k<15;k++) {

int x = aaa[i][k];

if (flag){

break;

}

if(x==2|x==6){

Log.e("x",""+x+"i:"+i+"k:"+k);

switch ( aaa[i][k+1]){

case 0://右边是墙,不能移动

break;

case 1://右边是空,可以移动

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i][k+1]=2;

break;

case 3://右边是空箱子

if(aaa[i][k+2]==5){//箱子右边是花

aaa[i][k+2]=4;

aaa[i][k+1]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i][k+2]==1){//箱子右边是空

aaa[i][k+2]=3;

aaa[i][k+1]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 4://右边是满箱子

if(aaa[i][k+2]==5){//箱子右边是花

aaa[i][k+2]=4;

aaa[i][k+1]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i][k+2]==1){//箱子右边是空

aaa[i][k+2]=3;

aaa[i][k+1]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 5://右边是花

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i][k+1]=6;

break;

}

flag=true;

}

}

}

postInvalidate();

ifPass();

}

public void moveUp(){

addBack();

flag=false;

for(int i=0;i<15;i++){

if (flag){

break;

}

for(int k=0;k<15;k++) {

int x = aaa[i][k];

if (flag){

break;

}

if(x==2|x==6){

Log.e("x",""+x+"i:"+i+"k:"+k);

switch ( aaa[i-1][k]){

case 0://上边是墙,不能移动

break;

case 1://上边是空,可以移动

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i-1][k]=2;

break;

case 3://上边是空箱子

if(aaa[i-2][k]==5){//箱子上边是花

aaa[i-2][k]=4;

aaa[i-1][k]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i-2][k]==1){//箱子上边是空

aaa[i-2][k]=3;

aaa[i-1][k]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 4://上边是满箱子

if(aaa[i-2][k]==5){//箱子上边是花

aaa[i-2][k]=4;

aaa[i-1][k]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i-2][k]==1){//箱子上边是空

aaa[i-2][k]=3;

aaa[i-1][k]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 5://上边是花

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i-1][k]=6;

break;

}

flag=true;

}

}

}

postInvalidate();

ifPass();

}

public void moveDown(){

addBack();

flag=false;

for(int i=0;i<15;i++){

if (flag){

break;

}

for(int k=0;k<15;k++) {

int x = aaa[i][k];

if (flag){

break;

}

if(x==2|x==6){

Log.e("x",""+x+"i:"+i+"k:"+k);

switch ( aaa[i+1][k]){

case 0://下边是墙,不能移动

break;

case 1://下边是空,可以移动

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i+1][k]=2;

break;

case 3://下边是空箱子

if(aaa[i+2][k]==5){//箱子下边是花

aaa[i+2][k]=4;

aaa[i+1][k]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i+2][k]==1){//箱子下边是空

aaa[i+2][k]=3;

aaa[i+1][k]=2;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 4://下边是满箱子

if(aaa[i+2][k]==5){//箱子下边是花

aaa[i+2][k]=4;

aaa[i+1][k]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else if(aaa[i+2][k]==1){//箱子下边是空

aaa[i+2][k]=3;

aaa[i+1][k]=6;

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

}else{}//是其他则不能移动

break;

case 5://下边是花

if(x==6){

aaa[i][k]=5;

}else{

aaa[i][k]=1;

}

aaa[i+1][k]=6;

break;

}

flag=true;

}

}

}

postInvalidate();

ifPass();

}

public void ifPass(){

flag=false;

for(int i=0;i<15;i++){

if (flag){

break;

}

for(int k=0;k<15;k++) {

int x = aaa[i][k];

if (flag){

break;

}

if(x==3){//还有空箱子

flag=true;

}

}

}

if (!flag){//没有一个空箱子

mPassLitener.pass();

}

}

public void moveBack(){

if(arrayList.size()>0){

this.aaa=(arrayList.get(arrayList.size()-1));

postInvalidate();

arrayList.remove(arrayList.size()-1);

}

}

public void addBack(){

if(kk>299){

arrayList.clear();

kk=0;

}

if(arrayList.size()>99){

arrayList.remove(0);

}

for(int i=0;i<15;i++){

for(int k=0;k<15;k++){

ccc[kk][i][k]=aaa[i][k];

}

}

arrayList.add(ccc[kk]);

kk++;

}

}

activity  :

package com.jisai.materialdesigndemo.tuixiangzhi;

import android.content.DialogInterface;

import android.graphics.Color;

import android.os.Bundle;

import android.support.design.widget.Snackbar;

import android.support.v7.app.AlertDialog;

import android.support.v7.app.AppCompatActivity;

import android.support.v7.widget.Toolbar;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.widget.Button;

import com.jisai.materialdesigndemo.R;

import java.util.ArrayList;

public class MainActivity_tuixiangzhi extends AppCompatActivity

{

ArrayList arrayList=new ArrayList<>();

Button up,down,left,right,back,nextup,nextdown;

View_tuixiangzhi myImageView_circle;

Toolbar mToolbar;

int LV=1;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_tuixiangzhi);

LV_data lv_data=new LV_data();

arrayList=lv_data.arrayList;

mToolbar = (Toolbar) findViewById(R.id.toolbar);

// mToolbar.setBackgroundColor(0xFF42B1CD);

mToolbar.setTitle("推箱子(第"+LV+"关)"); //设置标题

mToolbar.setTitleTextColor(Color.parseColor("#ffffff")); //设置标题颜色

setSupportActionBar(mToolbar);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

mToolbar.setNavigationOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

// onBackPressed();

finish();

//Toast.makeText(getApplicationContext(),"返回",Toast.LENGTH_SHORT).show();

}

});

myImageView_circle= (View_tuixiangzhi) findViewById(R.id.nnn);

myImageView_circle.setPassLitener(new View_tuixiangzhi.PassLitener() {

@Override

public void pass() {

final AlertDialog.Builder normalDialog =

new AlertDialog.Builder(MainActivity_tuixiangzhi.this);

normalDialog.setTitle("恭喜你");

normalDialog.setMessage("真厉害,你已通过本关!");

normalDialog.setPositiveButton("下一关",

new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialog, int which) {

if(LV

LV=LV+1;

myImageView_circle.setaaa(arrayList.get(LV-1));

mToolbar.setTitle("推箱子(第"+LV+"关)"); //设置标题

}else{

final Snackbar snackbar = Snackbar.make(up, "已是最后一关", Snackbar

.LENGTH_LONG);

snackbar.show();

snackbar.setAction("确定", new View.OnClickListener() {

@Override

public void onClick(View view) {

snackbar.dismiss();

}

});

}

}

});

// 显示

normalDialog.show();

}

});

up= (Button) findViewById(R.id.shang);

down= (Button) findViewById(R.id.xia);

left= (Button) findViewById(R.id.zuo);

right= (Button) findViewById(R.id.you);

back= (Button) findViewById(R.id.back);

nextup= (Button) findViewById(R.id.shangyi);

nextdown= (Button) findViewById(R.id.xiayi);

up.setOnClickListener(cccc);

down.setOnClickListener(cccc);

left.setOnClickListener(cccc);

right.setOnClickListener(cccc);

back.setOnClickListener(cccc);

nextup.setOnClickListener(cccc);

nextdown.setOnClickListener(cccc);

}

View.OnClickListener cccc = new View.OnClickListener() {

@Override

public void onClick(View v) {

switch (v.getId()){

case R.id.shang:

myImageView_circle.moveUp();

break;

case R.id.xia:

myImageView_circle.moveDown();

break;

case R.id.zuo:

myImageView_circle.moveLeft();

break;

case R.id.you:

myImageView_circle.moveRight();

break;

case R.id.back:

myImageView_circle.moveBack();

break;

case R.id.shangyi:

if(LV>1){

LV=LV-1;

myImageView_circle.setaaa(arrayList.get(LV-1));

mToolbar.setTitle("推箱子(第"+LV+"关)"); //设置标题

}

break;

case R.id.xiayi:

if(LV

LV=LV+1;

myImageView_circle.setaaa(arrayList.get(LV-1));

mToolbar.setTitle("推箱子(第"+LV+"关)"); //设置标题

}else{

final Snackbar snackbar = Snackbar.make(up, "已是最后一关", Snackbar

.LENGTH_LONG);

snackbar.show();

snackbar.setAction("确定", new View.OnClickListener() {

@Override

public void onClick(View view) {

snackbar.dismiss();

}

});

}

break;

}

}

};

@Override

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.menu_tuixiangzhi, menu);

return true;

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will

// automatically handle clicks on the Home/Up button, so long

// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();

//noinspection SimplifiableIfStatement

if (id == R.id.item1) {

myImageView_circle.setaaa(arrayList.get(LV-1));

return true;

}

return super.onOptionsItemSelected(item);

}

}

布局文件:

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

xmlns:app="http://schemas.android.com/apk/res-auto"

tools:context="com.jisai.materialdesigndemo.caipu.CaipuItemActivity">

android:id="@+id/toolbar"

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

app:layout_collapseMode="pin"

android:elevation="6dp"

android:background="?attr/colorPrimary"

app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"

app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

app:layout_scrollFlags="scroll|enterAlways"

/>

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@mipmap/bg3"

>

android:id="@+id/nnn"

android:layout_width="match_parent"

android:layout_height="wrap_content" />

android:layout_alignParentBottom="true"

android:layout_width="match_parent"

android:layout_height="150dp"

>

android:id="@+id/back"

android:layout_width="40dp"

android:layout_centerInParent="true"

android:layout_height="40dp"

android:background="@drawable/back2"

android:layout_margin="15dp"/>

android:id="@+id/shang"

android:layout_width="40dp"

android:layout_height="40dp"

android:background="@drawable/s_s"

android:layout_above="@+id/back"

android:layout_alignLeft="@+id/back"/>

android:id="@+id/xia"

android:layout_width="40dp"

android:layout_height="40dp"

android:background="@drawable/d_s"

android:layout_below="@+id/back"

android:layout_alignLeft="@+id/back"/>

android:id="@+id/zuo"

android:layout_width="40dp"

android:layout_height="40dp"

android:background="@drawable/l_s"

android:layout_toLeftOf="@+id/back"

android:layout_alignTop="@+id/back"/>

android:id="@+id/you"

android:layout_width="40dp"

android:layout_height="40dp"

android:background="@drawable/r_s"

android:layout_toRightOf="@+id/back"

android:layout_alignTop="@+id/back"/>

android:id="@+id/shangyi"

android:layout_width="40dp"

android:layout_height="40dp"

android:background="@drawable/l_n"

android:layout_marginBottom="40dp"

android:layout_marginLeft="15dp"

android:layout_alignParentBottom="true"

android:layout_alignParentLeft="true"

/>

android:layout_width="wrap_content"

android:layout_height="30dp"

android:layout_alignParentBottom="true"

android:layout_alignParentLeft="true"

android:layout_marginLeft="20dp"

android:text="上一关"/>

android:id="@+id/xiayi"

android:layout_width="40dp"

android:layout_height="40dp"

android:background="@drawable/r_n"

android:layout_marginBottom="40dp"

android:layout_marginRight="15dp"

android:layout_alignParentBottom="true"

android:layout_alignParentRight="true"

/>

android:layout_width="wrap_content"

android:layout_height="30dp"

android:layout_marginRight="20dp"

android:layout_alignParentBottom="true"

android:layout_alignParentRight="true"

android:text="下一关"/>

关卡数据(二位数组),我加了40关,太长这里就贴一点。

package com.jisai.materialdesigndemo.tuixiangzhi;

import java.util.ArrayList;

/**

* Created by Administrator on 17-4-11.

*/

public class LV_data {

final ArrayListarrayList = new ArrayList<>();

LV_data(){

int[][] LV_1 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,3,1,3,5,0,0,0,0,0},

{0,0,0,0,5,3,2,1,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,3,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,5,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_1);

int[][] LV_2 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,2,1,1,0,0,0,0,0,0,0,0},

{0,0,0,0,1,3,3,0,0,0,0,0,0,0,0},

{0,0,0,0,1,3,1,0,0,0,5,0,0,0,0},

{0,0,0,0,0,0,1,0,0,0,5,0,0,0,0},

{0,0,0,0,0,0,1,1,1,1,5,0,0,0,0},

{0,0,0,0,0,1,1,1,0,1,1,0,0,0,0},

{0,0,0,0,0,1,1,1,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_2);

int[][] LV_3 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},

{0,0,0,0,0,3,0,0,0,1,1,1,0,0,0},

{0,0,0,0,1,2,1,3,1,1,3,1,0,0,0},

{0,0,0,0,1,5,5,0,1,3,1,0,0,0,0},

{0,0,0,0,0,5,5,0,1,1,1,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_3);

int[][] LV_4 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,1,1,0,0,0,0,0,0,0},

{0,0,0,0,0,2,3,1,0,0,0,0,0,0,0},

{0,0,0,0,0,0,3,1,0,0,0,0,0,0,0},

{0,0,0,0,0,0,1,3,1,0,0,0,0,0,0},

{0,0,0,0,0,5,3,1,1,0,0,0,0,0,0},

{0,0,0,0,0,5,5,4,5,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_4);

int[][] LV_5 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,2,1,0,0,0,0,0,0,0,0},

{0,0,0,0,0,1,3,1,1,0,0,0,0,0,0},

{0,0,0,0,0,0,1,0,1,0,0,0,0,0,0},

{0,0,0,0,5,0,1,0,1,1,0,0,0,0,0},

{0,0,0,0,5,3,1,1,0,1,0,0,0,0,0},

{0,0,0,0,5,1,1,1,3,1,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_5);

int[][] LV_6 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},

{0,0,1,1,1,5,0,0,0,1,0,0,0,0,0},

{0,0,1,0,1,0,1,1,1,1,0,0,0,0,0},

{0,0,1,0,1,3,1,3,0,5,1,0,0,0,0},

{0,0,1,0,1,1,4,1,1,0,1,0,0,0,0},

{0,0,1,5,0,3,1,3,1,0,1,0,0,0,0},

{0,0,0,1,1,1,1,0,1,0,1,0,0,0,0},

{0,0,0,1,0,0,0,5,1,1,1,1,2,0,0},

{0,0,0,1,1,1,1,1,0,0,1,1,1,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_6);

int[][] LV_7 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,1,1,1,0,0,0,0,0,0,0,0,0},

{0,0,0,1,3,1,5,5,1,3,1,0,0,0,0},

{0,0,0,0,3,1,5,5,3,3,2,0,0,0,0},

{0,0,0,0,1,1,5,5,1,3,1,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_7);

int[][] LV_8 ={//0是墙,1是空,2是人,3是空箱子,4是满箱子,5是花,6是人加花

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,1,1,1,1,0,0,0,0},

{0,0,0,0,0,5,1,3,0,0,1,0,0,0,0},

{0,0,0,0,5,5,3,1,3,1,1,2,0,0,0},

{0,0,0,0,5,5,1,3,1,3,1,0,0,0,0},

{0,0,0,0,0,0,0,0,0,1,1,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

arrayList.add(LV_8);

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/555760.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

android没有捂脸表情,微信新emoji表情安卓机怎么没有?微信新emoji表情安卓机没有怎么回事?...

在最新版ios版微信中不少用户在聊天时发现了新emoji表情哟&#xff0c;但是安卓机最新版即没有发现&#xff0c;那么微信新emoji表情安卓机怎么没有&#xff1f;微信新emoji表情安卓机没有怎么回事&#xff1f;下面小编就给大家具体介绍下。iOS版微信总共加入了9款新表情&#…

springboot源码分析: 请求方式+请求映射原理+获取参数原理

注解相关 AliasFor&#xff1a;.在同个注解中为同一个功能定义两个名称不一样的属性&#xff0c;那么这两个属性彼此互为别名 RequestMapping注解里面的代码 AliasFor("path")String[] value() default {};AliasFor("value")String[] path() default {};G…

android 或者vide的高度和宽度,关于Android中videoView.setVideoPath(“PATH”)的问题!!!急!!...

满意答案yfdsan31972015.06.03采纳率&#xff1a;52% 等级&#xff1a;9已帮助&#xff1a;364人path 是获取的路径&#xff0c;如果你把视频文件夹写在raw文件夹下 &#xff0c;/*** raw文件夹下的文件处理工具类** */public class RawFileUtils {private RawFileUtils( ){…

吃透Java IO:字节流、字符流、缓冲流

文章目录前言1 初识Java IO1.1 IO流分类1.2 案例实操2 IO流对象2.1 File类2.2 字节流2.3 字符流2.4 序列化3 IO流方法3.1 字节流方法3.2 字符流方法4 附加内容4.1 位、字节、字符4.2 IO流效率对比4.3 NIO前言 有人曾问fastjson的作者&#xff08;阿里技术专家高铁&#xff09;&…

android 侧滑删除功能,200行代码让你在Android中完美实现iOS版侧滑删除效果

使用几个月的IOS之后,发现IOS中侧滑删除俺就大家好&#xff0c;自己开始学习Android已经差不多半年了吧&#xff0c;前前后后看了不少的博客获益匪浅。渐渐的随着技术的提升&#xff0c;慢慢感觉网上其它的一些功能的实现又不是那么完美&#xff0c;今天就给大家带来一篇在Andr…

java IO体系的学习总结

1.Java Io流的概念&#xff0c;分类&#xff0c;类图。 1.1 Java Io流的概念 ? ? java的io是实现输入和输出的基础&#xff0c;可以方便的实现数据的输入和输出操作。在java中把不同的输入/输出源&#xff08;键盘&#xff0c;文件&#xff0c;网络连接等&#xff09;抽象表…

android10获取imei,Android 10 root用户获取imei

IMEI(International Mobile Equipment Identity)是国际移动设备识别码的缩写&#xff0c;由15-17位数字组成&#xff0c;与手机是一一对应的关系。无论刷机还是恢复出厂设置&#xff0c;该设备标识码都不会改变&#xff0c;所以在广告和流量统计等方面特别好用&#xff0c;备受…

JAVA基础之HttpServletResponse响应

JAVA基础之HttpServletResponse响应 用户在客户端输入网址&#xff08;虚拟路径&#xff09;时&#xff0c;开始发送一个HTTP请求&#xff08;请求行、请求头、请求体&#xff09;至服务器。服务器内的Tomcat引擎会解析请求的地址&#xff0c;去找XML文件&#xff0c;然后根据…

Logger之Logger.getLogger(CLass)

之前一直在使用System.out.println()来调试.但是用这种方式开发项目部署到生产环境,会因为众多的控制台输出降低应用的性能.这时候Log4J就成为可平衡开发和部署应用的利器了. 在项目中使用Log4J并不是一件困难的事情,简单粗暴的方式就是在每个类A中声明一个Logger私有属性 pri…

订阅号助手android,微信订阅号助手app

微信订阅号助手app属于微信官方推出的软件&#xff0c;可以把我们的手机当做公众号的平台&#xff0c;让你直接用手机来实现公众号的各种工作、互动内容&#xff0c;微信订阅号助手app不用担心使用一些第三方软件被封号了&#xff0c;非常实用可靠。【应用介绍】订阅号助手是一…

使用LoggerFactory.getLogger(xxx.class)方法在控制台打印日志信息

使用System.out.println()来调试.但是用这种方式开发项目部署到生产环境,会因为众多的控制台输出降低应用的性能.这时候Log4J就成为可平衡开发和部署应用的利器了. 使用指定的类XXX初始化日志对象&#xff0c;方便在日志输出的时候&#xff0c;可以打印出日志信息所属的类。 …

html自动增加vbs代码,vbs脚本病毒代码大全编步骤四个

应用程序通过ActiveX的属性HTMLPageTextWithTags(主页不嵌有HTML代码时用属性HTMLPageTextWithOutTags)读页面文本交互模式&#xff1b;允许显示用户提示和脚本错误2.ntlm.vbs***************ntlm.vbsby黑嘿黑***************dimwshsetwshCreateObject("WScript.Shell&quo…

java util logger slf4j_别再自己用LoggerFactory生成logger实例了,试试slf4j注解

背景 在项目开发中&#xff0c;记录日志是必做的一件事情。日志的实现有很多种&#xff1a;Logback&#xff0c;Log4j2&#xff0c;log4j&#xff0c;JAVA Util Logging等等。 而slf4j是一个适配层&#xff0c;由适配层决定使用哪一种日志系统&#xff0c;而调用端只需要做的…

日志框架介绍(SLF4J及其使用)

本文主要介绍 1.日志框架基本介绍及Spring Boot中默认使用框架(SLF4JLogBack); 2.SLF4J的使用 3.项目中日志框架统一问题 4.Spring Boot中如何实现日志框架统一问题(3的最佳实践) 1. 日志框架基本介绍 一般情况下搭建日志框架时&#xff0c;搭建 日志抽象层&#xff08;定…

jmeter生成html报告修改,Jmeter生成html报告(示例代码)

新的JMeter版本中引入了Dashboard Report&#xff0c;用于生成HTML页面格式图形化报告的扩展模块。注&#xff1a;本文用的是3.2版本。生成html报告一、检查.jtl文件&#xff0c;如果没有.jtl文件&#xff0c;运行如下命令&#xff1a;jmeter -n -t 天气api.jmx -l result.jtl …

SpringBoot使用Slf4j+Log4j2完成项目的日志记录

SpringBoot使用Slf4jLog4j完成项目的日志记录 前言 本示例采用SpringBoot项目使用SpringAOP记录日志&#xff0c;Slf4j作为日志门面&#xff0c;Log4j2作为日志实现实&#xff0c;实现开发中的日志记录. 部分效果展示 &#xff1a; 日志文件 : 日志信息 : 代码具体实现如下…

鸿蒙构架谁提供的,科普丨关于“鸿蒙”,不知道这些你都不好意思跟别人打招呼!...

鸿蒙的英文名是Harmony OS华为消费者业务CEO余承东8月9日正式发布鸿蒙系统&#xff0c;英文名是Harmony OS 。国家知识产权局商标局网站显示&#xff0c;华为已经申请注册“华为鸿蒙”商标&#xff0c;申请日期是2018年8月24日&#xff0c;注册公告日期是2019年5月14日。鸿蒙是…

springBoot Logging 日志详解

文章目录日志格式控制台输出彩色编码输出文件输出文件级别自定义日志配置Logback 扩展profile 指定 配置文件Environment 属性springBoot 日志使用Commons Logging作为抽象层&#xff0c;并将具体实现开放&#xff0c;支持Java Util Logging、Log4j2和Logback。loggers 默认配置…

计算机应用电子技术课程,中专计算机应用有什么课程

中专计算机应用有什么课程2020-10-29 16:40:11文/董玉莹计算机应用学习研究计算机应用于各个领域的理论、方法、技术和系统等&#xff0c;是计算机学科与其他学科相结合的边缘学科&#xff0c;是计算机学科的组成部分。计算机应用是对在社会活动中的如何参与和实施给予方针指导…

Spring Boot 配置日志输出等级

Spring boot 默认使用 logback作进行日志输出。 有两种方式一个是通过application.properties 配置文件的方式来配置。 另一种是通过logback.xml配置文件的方式进行配置。 首先要说的是:application.properties 和logback.xml这两个配置文件都是放在 src/main/resources 目录…