📄 moombackground.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.* ;
import javax.microedition.rms.*;
public class MoomBackground extends TiledLayer {
private int[][] map1={{ 3, 4, 3, 4, 3, 4,3,4,0,0, 0,0,3,4,3, 4,3,4, 3, 4,3,4,3,4,3,4, 3, 4,3,4, 3,4, 3,4,3,4,3, 4,3,4, 3, 4, 3, 4,3,4, 3, 4,3,4, 3, 4, 3, 4, 3, 4},
{ 3, 4, 3, 4, 3, 4,3,4,0,0, 0,0,3,4,3, 4,3,4, 3, 4,3,4,3,4,3,4, 3, 4,3,4, 3,4, 3,4,3,4,3, 4,3,4, 3, 4, 3, 4,3,4, 3, 4,3,4, 3, 4, 3, 4, 3, 4},
{ 3, 4, 3, 4, 3, 4,3,4,3,4, 0,0,0,0,0, 0,0,0, 0, 0,3,4,3,4,0,0, 0, 0,0,0, 0,0, 0,0,0,4,3, 0,0,0, 0, 0, 0, 0,0,0, 0, 0,0,0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0, 0, 0,0,0,0,0,0,0, 0, 0,0,0, 0,0, 0,0,0,4,3, 0,0,0, 0, 0, 0, 0,0,0, 0, 0,0,0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0, 0, 0,0,0,0,0,0,0, 0, 0,0,0, 0,0, 0,0,0,4,3, 0,0,0, 0, 0, 0, 0,0,0, 0, 0,0,0, 0, 0, 0, 0,25,30},
{ 0, 0, 0, 0, 0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0, 0, 0,0,0,0,0,0,0, 0, 0,0,0, 0,0, 0,0,0,4,3, 0,0,0, 0, 0, 0, 0,0,0, 0, 0,0,0, 0, 0, 0, 0,26,31},
{ 0, 0, 0, 0, 0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0, 0, 0,0,0,0,0,0,0, 0, 0,0,0, 0,0, 0,0,0,0,0, 0,0,0, 0, 0, 0, 0,0,0, 0, 0,0,0, 0, 0, 0, 0,27,32},
{ 0, 0, 0, 0, 0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0, 0, 0,0,0,0,0,0,0, 0, 0,0,0, 0,0, 0,0,0,0,0, 0,0,0, 18,0, 0, 0,0,0, 0, 0,0,0, 0, 0, 0, 0,28,33},
{ 0, 0, 0, 0, 0, 0,0,0,5,6, 7,0,0,5,6, 7,0,0,11,13,0,0,0,0,0,0,11,13,0,0, 0,0, 0,0,0,5,6, 7,0,0, 0, 0,11,13,0,0,11,13,0,0, 0, 0, 0, 0,29,34},
{ 35,35,35,35,35,35,0,0,8,9,10,0,0,8,9,10,0,0,12,14,1,1,1,1,1,1,12,14,0,0,35,0,35,0,0,8,9,10,0,0, 0, 0,12,14,1,1,12,14,0,0,19,20,21,22,23,24}};
private int[][] map2={{33,34,35,36,37,38, 0, 0, 0, 0, 0, 0, 0, 0,39,40,33,34,35,36,37,38,39,40,33,34,35,36,37,38,39,40,33,34,35,36,37,38,39,40,33,34,35,36,37,38,39,40,33,34,35,36,37,38,39,40},
{ 41,42,43,44,45,46,12,12,12,12,12,12,12,12,47,48,41,42,43,44,45,46,47,48,41,42,43,44,45,46,47,48,41,42,43,44,45,46,47,48,41,42,43,44,45,46,47,48,41,42,43,44,45,46,47,48},
{ 0 ,0 ,0 ,0 ,0 ,0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0, 0, 0, 0,14, 0 ,0 ,0 ,0 ,0 ,0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0 ,0 ,0 ,0 ,0 ,0, 0, 0,14, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0, 0, 0, 0, 0, 0 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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0, 0, 0, 0,25,30},
{13 ,15,15,15,0,0,0,0,0,4,0,0,0,0,0,0,0,0,15,15,15,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0, 0, 0, 0, 0,26,31},
{14 ,0 ,0 ,0 ,0,0,6,0,0,5,0,0,4,0,0,7,8,0, 0, 0, 0, 0, 0, 0,0,0,7,8,0,0,6,0,0,6,0,0,6,0,0,5,0,0,6,0,0,6,0,0,6,0, 0, 0, 0, 0,27,32},
{ 9, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,18,19,20,21,22}};
private int[][] map4={{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{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,2,1,2,1,2,1,2}};
private int[][] map=new int[56][10];
public int i=0,j=0;
public int row=0,column=0;;
public int testX=0,testY=2;
public MoomBackground (int column,int row,Image img,int w,int h,int level){
super(column,row,img,w,h);
this.setlevel(level);
this.row=row;
this.column=column;
for (i=0;i<row;i++)
for(j=0;j<column;j++)
setCell(j,i,map[i][j]);
}
public void relayer (){
for (i=0;i<row;i++)
for(j=0;j<column;j++)
setCell(j,i,map[i][j]);
}
public void setlevel(int level){
Image img=null;
try{
if(level==1)
map=map1;
if (level==2){
map=map2;
img =Image.createImage("/Moom/stageground2.png");
setStaticTileSet(img,32,20);
}
if(level==3){
map=map3;
img =Image.createImage("/Moom/stageground3.png");
setStaticTileSet(img,32,20);
}
if(level==4){
map=map4;
img =Image.createImage("/Moom/stageground2.png");
setStaticTileSet(img,32,20);
column=8;
}
}catch(Exception e){}
relayer();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -