Пример #1
0
 public void animateStep(float deltaTime, float time) {
   if (!m_onScreen) {
     if (player == null) {
       GameMain.getSingleton().playSound(soundName, volume);
     } else {
       GameMain.getSingleton().playSound(soundName, player, m_target, volume, minVolume);
     }
   } else if (m_target.getParent().isOnScreen(m_target.getX(), m_target.getY())) {
     if (player == null) {
       GameMain.getSingleton().playSound(soundName, volume);
     } else {
       GameMain.getSingleton().playSound(soundName, player, m_target, volume, minVolume);
     }
   }
 }
Пример #2
0
 public GameMenu(GameMain midlet_ /*,ConnectionServer conn_,RoleDataValue roleData_*/) {
   // true->使用GameAction(boolean suppressKeyEvents) , false->不使用GameAction(boolean
   // suppressKeyEvents)
   super(false);
   // 使用全螢幕
   setFullScreenMode(true);
   midlet = midlet_;
   // music = music_;
   // roleData = roleData_;
   display = midlet.getDisplay();
   layMa = new LayerManager();
   spInterface = new Sprite(createImage("/image/gameInterface/inface.png"), bgWidth, bgHeight);
   spName = new Sprite(createImage("/image/gameInterface/Title.png"), 84, 15);
   menustate = 0;
   menuNum = 3;
   // setFullScreenMode(true);
   g = getGraphics();
   /*if(!(getWidth()<176) || !(getHeight()<208)){
   	disWidth = (getWidth()-176)/2;//抓取螢幕的中心點
   	disHeight = (getHeight()-208)/2;//抓取螢幕的中心點
   }*/
   // 設定Sprite位置
   spName.setPosition(80, 20);
   spInterface.setPosition(0, 0);
   // 加入到LayerManager
   layMa.append(spName);
   spName.setVisible(false);
   layMa.append(spInterface);
   spInterface.setFrame(0);
   System.out.println("start");
   start();
 }
 // Constructor
 public LevelOne(GameMain main) {
   this.main = main;
   setFocusable(true); // so that can receive key-events
   setPreferredSize(screenDimension);
   requestFocus();
   main.setState(this);
 }
Пример #4
0
 // 關閉程式
 public void exit() {
   drawDisplay();
   try {
     Thread.sleep(2000);
   } catch (Exception e) {
   }
   // backupmusic.stop();
   // backupmusic = null;
   midlet.exit();
 }
 @Override
 public void doAction() {
   main.add(this, BorderLayout.CENTER);
   gameController = new GameController(this);
   this.main.setGameState(GameState.INITIALIZED);
 }