package ManicMiner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.io.IOException;

/**
 * @author supervisor
 */
public class RemakeManicMiner {

    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Image ManicMiner;
    private Sprite ManicMinerPJ;
    public int ManicMinerPJseq001Delay = 200;
    public int[] ManicMinerPJseq001 = {0, 1, 2, 1};
    private Image mapa1;
    public int llaveseq001Delay = 50;
    public int[] llaveseq001 = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29};
    public int Deslizadorseq001Delay = 200;
    public int[] Deslizadorseq001 = {30, 33, 31, 32, 33};
    public int SueloArenososeq001Delay = 200;
    public int[] SueloArenososeq001 = {34, 35, 36, 37, 38, 39, 40, 41, 42};
    private TiledLayer tilesMapa1;
    public int llaveTilesMapa1;
    public int DeslizadorTilesMapa1;
    private Image backgroundMapa1;
    private TiledLayer background1;
    private Image monstruo1;
    private Sprite MonstruoTrompeta;
    public int MonstruoTrompetaseq001Delay = 200;
    public int[] MonstruoTrompetaseq001 = {0, 2, 1, 3};
    //</editor-fold>//GEN-END:|fields|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    public Image getManicMiner() throws java.io.IOException {//GEN-BEGIN:|1-getter|0|1-preInit
        if (ManicMiner == null) {//GEN-END:|1-getter|0|1-preInit
            // write pre-init user code here
            ManicMiner = Image.createImage("/ManicMiner.png");//GEN-BEGIN:|1-getter|1|1-postInit
        }//GEN-END:|1-getter|1|1-postInit
        // write post-init user code here
        return this.ManicMiner;//GEN-BEGIN:|1-getter|2|
    }
//GEN-END:|1-getter|2|

    public Sprite getManicMinerPJ() throws java.io.IOException {//GEN-BEGIN:|2-getter|0|2-preInit
        if (ManicMinerPJ == null) {//GEN-END:|2-getter|0|2-preInit
            // write pre-init user code here
            ManicMinerPJ = new Sprite(getManicMiner(), 10, 16);//GEN-BEGIN:|2-getter|1|2-postInit
            ManicMinerPJ.setFrameSequence(ManicMinerPJseq001);//GEN-END:|2-getter|1|2-postInit
            // write post-init user code here
        }//GEN-BEGIN:|2-getter|2|
        return ManicMinerPJ;
    }
//GEN-END:|2-getter|2|

    public Image getMapa1() throws java.io.IOException {//GEN-BEGIN:|4-getter|0|4-preInit
        if (mapa1 == null) {//GEN-END:|4-getter|0|4-preInit
            // write pre-init user code here
            mapa1 = Image.createImage("/mapa1.png");//GEN-BEGIN:|4-getter|1|4-postInit
        }//GEN-END:|4-getter|1|4-postInit
        // write post-init user code here
        return this.mapa1;//GEN-BEGIN:|4-getter|2|
    }
//GEN-END:|4-getter|2|

    public TiledLayer getTilesMapa1() throws java.io.IOException {//GEN-BEGIN:|5-getter|0|5-preInit
        if (tilesMapa1 == null) {//GEN-END:|5-getter|0|5-preInit
            // write pre-init user code here
            tilesMapa1 = new TiledLayer(32, 16, getMapa1(), 8, 8);//GEN-BEGIN:|5-getter|1|5-midInit
            llaveTilesMapa1 = tilesMapa1.createAnimatedTile(llaveseq001[0]);
            DeslizadorTilesMapa1 = tilesMapa1.createAnimatedTile(Deslizadorseq001[0]);
            int[][] tiles = {
                { 3, 0, 0, 0, 0, 0, 0, 0, 0, llaveTilesMapa1, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, llaveTilesMapa1, 0, 3 },
                { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, llaveTilesMapa1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 },
                { 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, 3 },
                { 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, 3 },
                { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, llaveTilesMapa1, 0, 0, 2, 0, 0, 0, 3 },
                { 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 5, 1, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 3 },
                { 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, llaveTilesMapa1, 3 },
                { 3, 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, 3 },
                { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 },
                { 3, 1, 1, 1, 1, 0, 0, 0, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, DeslizadorTilesMapa1, 0, 0, 0, 3 },
                { 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, 1, 1, 3 },
                { 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, 3 },
                { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 5, 5, 5, 5, 5, 1, 1, 1, 3 },
                { 3, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 },
                { 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, 3 },
                { 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 }
            };//GEN-END:|5-getter|1|5-midInit
            // write mid-init user code here
            for (int row = 0; row < 16; row++) {//GEN-BEGIN:|5-getter|2|5-postInit
                for (int col = 0; col < 32; col++) {
                    tilesMapa1.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|5-getter|2|5-postInit
        // write post-init user code here
        return tilesMapa1;//GEN-BEGIN:|5-getter|3|
    }
//GEN-END:|5-getter|3|

    public void updateLayerManagerForFase1(LayerManager lm) throws java.io.IOException {//GEN-LINE:|12-updateLayerManager|0|12-preUpdate
        // write pre-update user code here
        getMonstruoTrompeta().setPosition(83, 54);//GEN-BEGIN:|12-updateLayerManager|1|12-postUpdate
        getMonstruoTrompeta().setVisible(true);
        lm.append(getMonstruoTrompeta());
        getManicMinerPJ().setPosition(23, 104);
        getManicMinerPJ().setVisible(true);
        lm.append(getManicMinerPJ());
        getTilesMapa1().setPosition(0, 0);
        getTilesMapa1().setVisible(true);
        lm.append(getTilesMapa1());
        getBackground1().setPosition(0, 0);
        getBackground1().setVisible(true);
        lm.append(getBackground1());//GEN-END:|12-updateLayerManager|1|12-postUpdate
        // write post-update user code here
    }//GEN-BEGIN:|12-updateLayerManager|2|
//GEN-END:|12-updateLayerManager|2|

    public Image getBackgroundMapa1() throws java.io.IOException {//GEN-BEGIN:|20-getter|0|20-preInit
        if (backgroundMapa1 == null) {//GEN-END:|20-getter|0|20-preInit
            // write pre-init user code here
            backgroundMapa1 = Image.createImage("/backgroundMapa1.png");//GEN-BEGIN:|20-getter|1|20-postInit
        }//GEN-END:|20-getter|1|20-postInit
        // write post-init user code here
        return this.backgroundMapa1;//GEN-BEGIN:|20-getter|2|
    }
//GEN-END:|20-getter|2|

    public TiledLayer getBackground1() throws java.io.IOException {//GEN-BEGIN:|75-getter|0|75-preInit
        if (background1 == null) {//GEN-END:|75-getter|0|75-preInit
            // write pre-init user code here
            background1 = new TiledLayer(20, 20, getBackgroundMapa1(), 256, 128);//GEN-BEGIN:|75-getter|1|75-midInit
            int[][] tiles = {
                { 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, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
            };//GEN-END:|75-getter|1|75-midInit
            // write mid-init user code here
            for (int row = 0; row < 20; row++) {//GEN-BEGIN:|75-getter|2|75-postInit
                for (int col = 0; col < 20; col++) {
                    background1.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|75-getter|2|75-postInit
        // write post-init user code here
        return background1;//GEN-BEGIN:|75-getter|3|
    }
//GEN-END:|75-getter|3|

    public Image getMonstruo1() throws java.io.IOException {//GEN-BEGIN:|92-getter|0|92-preInit
        if (monstruo1 == null) {//GEN-END:|92-getter|0|92-preInit
            // write pre-init user code here
            monstruo1 = Image.createImage("/monstruo1.png");//GEN-BEGIN:|92-getter|1|92-postInit
        }//GEN-END:|92-getter|1|92-postInit
        // write post-init user code here
        return this.monstruo1;//GEN-BEGIN:|92-getter|2|
    }
//GEN-END:|92-getter|2|

    public Sprite getMonstruoTrompeta() throws java.io.IOException {//GEN-BEGIN:|93-getter|0|93-preInit
        if (MonstruoTrompeta == null) {//GEN-END:|93-getter|0|93-preInit
            // write pre-init user code here
            MonstruoTrompeta = new Sprite(getMonstruo1(), 12, 16);//GEN-BEGIN:|93-getter|1|93-postInit
            MonstruoTrompeta.setFrameSequence(MonstruoTrompetaseq001);//GEN-END:|93-getter|1|93-postInit
            // write post-init user code here
        }//GEN-BEGIN:|93-getter|2|
        return MonstruoTrompeta;
    }
//GEN-END:|93-getter|2|



}
