⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameplay.java~16~

📁 J2ME游戏引擎,直接在JBUILDER2006下运行,不包含需要的SDK和虚拟机
💻 JAVA~16~
字号:
import java.util.Vector;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0.0 */public class GamePlay extends GameFrameBase{    //Gaming Consts    /*final static byte STAGE_COUNT = 1;    final static byte BLOCK_SIZE = 24;    final static byte SMALL_BLOCK_SIZE = 16;    final static byte MAP_X_LENGTH = 5;    final static byte MAP_Y_LENGTH = 4;    final static byte START_POS_X = 4;    final static byte START_POS_Y = 1;*/    //=变量定义=================  /*  private byte m_i_CarSpeed;    byte m_Curr_StageData[][];    int m_i_CurrStage;    int m_i_CarPosX, m_i_CarPosY, m_i_CarRaw, m_i_CarCol, m_i_CarDirect,        m_i_StartCountLeft, iTemp;*/    //==================================END=     CMap Map=null;    //=图片资源=================    private Surface m_Surface_BigRoad = null;    private Surface m_Surface_Player = null;    private Surface m_Surface_SmallRoad = null;    private Surface m_Surface_SmallCar = null;    private Surface m_Surface_Icons = null;    private Surface m_Surface_Digits = null;    private Surface m_Surface_Boom = null;    private Surface m_Surface_TitleNext = null;    private Surface m_Surface_TitleGameOver = null;    //==================================END=    public GamePlay()    {        m_vect_SurfacePath = new Vector();        m_vect_SurfacePath.addElement("/map3.png");        m_vect_SurfacePath.addElement("/man1.png");        m_vect_SurfacePath.addElement("/smallroad.png");        m_vect_SurfacePath.addElement("/smallcar.png");        m_vect_SurfacePath.addElement("/icons.png");        m_vect_SurfacePath.addElement("/digits.png");        m_vect_SurfacePath.addElement("/boom.png");        m_vect_SurfacePath.addElement("/title_next.png");        m_vect_SurfacePath.addElement("/title_gameover.png");       // m_Curr_StageData = new byte[MAP_Y_LENGTH][MAP_X_LENGTH];    }    public void Create(GameViewBase view)    {        m_View = view;        //m_BackGraphy = m_View.m_g_BackGraphy;        m_Surface_BigRoad = m_View.nextSurface();        m_Surface_Player = m_View.nextSurface();        m_Surface_SmallRoad = m_View.nextSurface();        m_Surface_SmallCar = m_View.nextSurface();        m_Surface_Icons = m_View.nextSurface();        m_Surface_Digits = m_View.nextSurface();        m_Surface_Boom = m_View.nextSurface();        m_Surface_TitleNext = m_View.nextSurface();        m_Surface_TitleGameOver = m_View.nextSurface();        NewGame();    }    public void Release()    {        if(m_View != null)            m_View.ReleaseAllSurfaces();    }    public void NewGame()    {        if( Map == null)       {         Map = new CMap(m_View);         Map.Create(m_Surface_BigRoad) ;         }    /*    m_i_CurrStage = iStage;        for (int i = 0; i < MAP_Y_LENGTH; i++)        {            for (int j = 0; j < MAP_X_LENGTH; j++)                m_Curr_StageData[i][j] = STAGE_DATA[iStage % STAGE_COUNT][i][j];        }        m_i_CarSpeed = (byte) (2 + (iStage / STAGE_COUNT));        if (m_i_CarSpeed == 5)            m_i_CarSpeed = 6;        if (m_i_CarSpeed > 6)            m_i_CarSpeed = 8;        m_i_CarPosX = 0;        m_i_CarPosY = (MAP_Y_LENGTH + 1) * BLOCK_SIZE;        m_i_CarDirect = 0;        m_i_StartCountLeft = 5;        iTemp = 0;        m_i_FrameState = PLAYS_NEXT_LEVEL;*/    }    public void OnKeyDown(int iScanCode)    {        switch (m_i_FrameState)        {            /*case PLAYS_COUNT_DOWN:            case PLAYS_PLAYING:                switch (iScanCode)                {                    case GameViewBase.KEY_SOFTKEY1:                    case GameViewBase.KEY_FIRE:                        for (int i = 0; i < MAP_Y_LENGTH; i++)                        {                            for (int j = 0; j < MAP_X_LENGTH; j++)                            {                                if (m_Curr_StageData[i][j] > 0)                                {                                    m_Curr_StageData[i][j]++;                                    if (m_Curr_StageData[i][j] > 4)                                        m_Curr_StageData[i][j] = 1;                                }                            }                        }                        break;                }                break;*/        }    }    public void OnKeyUp(int iScanCode)    {    }    public void Show()    {       // switch (m_i_FrameState)       // {       System.out.print("ddddddd");          Map.DRAWMAP(0);           m_BackGraphy.setColor(62, 62, 62);        m_BackGraphy.fillRect(0, 0, m_View.m_i_ScreenWidth, m_View.m_i_ScreenHeight);       // }    }    public void GotoGameOver()    {       // m_View.m_pge_gamerank.GotoGameRank(m_i_CurrStage);        //m_View.m_pge_gameswitch.SwitchFrame(this, m_View.m_pge_gamerank);        /*        if (m_View.m_pge_gamerank == null)            m_View.m_pge_gamerank = new GameRank();        m_View.m_pge_gamerank.ReadRankAndOptions();        if (m_i_CurrStage + 1 >= m_View.m_pge_gamerank.m_i_RankScore[4])        {            if (m_View.gameSignBoard == null)                m_View.gameSignBoard = new GameSignBoard();            m_View.m_pge_gameswitch.SwitchFrame(this, m_View.gameSignBoard);        }        else            m_View.m_pge_gameswitch.SwitchFrame(this, m_View.m_pge_gamerank);        m_View.m_pge_CurrentPage = m_View.m_pge_gameswitch;        m_View.m_pge_gameswitch.Create(m_View);            */    }   /* private void DrawCar()    {        m_View.Blt(m_i_CarPosX + START_POS_X, m_i_CarPosY + START_POS_Y,                   BLOCK_SIZE, BLOCK_SIZE, m_i_CarDirect * BLOCK_SIZE, 0,                   m_Surface_BigCar);    }*/    private void DrawGameOver()    {    }    private void DrawGameBackGround()    {       /* m_BackGraphy.setColor(62, 62, 62);        m_BackGraphy.fillRect(0, 0, m_View.m_i_ScreenWidth, m_View.m_i_ScreenHeight);        m_BackGraphy.setColor(255, 235, 0);        m_BackGraphy.fillRect(0, 0, m_View.m_i_ScreenWidth, START_POS_Y);        m_BackGraphy.fillRect(0, 0, START_POS_X, m_View.m_i_ScreenHeight);        m_BackGraphy.fillRect(m_View.m_i_ScreenWidth - START_POS_X, 0,                                       m_View.m_i_ScreenWidth, m_View.m_i_ScreenHeight);        m_BackGraphy.fillRect(0, m_View.m_i_ScreenHeight - START_POS_Y,                                       m_View.m_i_ScreenWidth, m_View.m_i_ScreenHeight);*/    }    //============================================END=}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -