Scene.java
package brave;
import javax.microedition.lcdui.game.TiledLayer;
import javax.microedition.lcdui.Image;
public class Scene
{
public static TiledLayer createTiledLayerByBackground(Image
image)
{
TiledLayer tiledLayer = new TiledLayer(10, 8, image, 48, 64);
tiledLayer.fillCells(0, 0, 10, 8, 2);
return tiledLayer;
}
public static TiledLayer createTiledLayerByForeground(Image
image)
{
TiledLayer tiledLayer = new TiledLayer(30, 32, image, 16,
16);
// 30 * 32
int[] maplist =
{
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25
26 27 28 29
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,//00
,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,
29,29,29,29,29,29,29,29,29,29,29,30,0 ,//1
0 ,34,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0
,0 ,0 ,0 ,36,0 ,//2
0 ,34,0 ,1 ,2 ,3 ,4 ,5 ,0 ,0 ,0 ,1 ,2 ,3 ,3 ,26,3 ,
3 ,4 ,5 ,0 ,0 ,1 ,2 ,3
,4 ,5 ,0 ,36,0 ,//3
0 ,34,0 ,7 ,8 ,46,10,11,0 ,0 ,0 ,7 ,8 ,47,31,
32,33,47,10,11,0 ,0 ,7 ,8
,46,10,11,0 ,36,0 ,//4
0 ,34,0 ,13,14,15,16,17,0 ,0 ,0 ,13,14,14,37,
38,39,14,16,17,0 ,0
,13,14,15,16,17,0 ,36,0 ,//5
0 ,34,0 ,19,20,21,22,23,6 ,0 ,0 ,19,20,
20,43,44,45,20,20,23,0 ,0
,19,20,21,22,23,0 ,36,0 ,//6
0 ,34,0 ,0 ,0 ,12,0 ,0 ,0 ,0 ,0 ,24,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