J2ME中的 GAME API介绍[29]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

               mySub = null;

               mySub = new Sub(this, SubMIDlet.createImage("/res/sub.png"), getWidth() / 3, getHeight() / 3, layerManager);

              

           }

          

           //创建背景图层

           this.createSandBackground();

           this.createSunkenBoat();

          

           this.createFishCollection(0, FishCollection.NUM_FISH_TYPES);

           this.createMysub();

           this.createSeaBackground();

 

          

           mySub.setPosition(getWidth() / 3, getHeight() / 3);

           gameState = GAME_RUN;

          

       }else if(gameState == GAME_RUN){

           //游戏处于运行状态

           //提供游戏运行标识Flag,保证对用户操作的响应和"敌人"的运行动作只有在运行的时候生效

           //在性能过耗(可用内存不到当前内存总量的4/5时),进行垃圾回收GC

          

           if(rt.freeMemory() < (rt.totalMemory() * 4 / 5)){

               rt.gc();

           }

本文关键:J2ME中的 GAME API介绍
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top