2 Replies Latest reply on Nov 23, 2009 2:32 PM by 843853

    need help on mobile gaming development basic

      my game canvas is like this

      public a1Canvas(Display display){
      this.display = display;
      frameDelay = 33;
      gameOverState = false;

      public void start(){

      try {
      //get the images up
      } catch (IOException ex) {
      System.err.println("Failed to load images");

      Thread t = new Thread(this);

      public void run() {

      while (!gameOverState){

      }catch(InterruptedException ie){}



      private void draw(Graphics graphics) {
      //clear background to black

      //draw the background

      private void update() {
      // Process user input

      // Check for game over condition
      if ( collision detection )
      gameOverState = true;


      private void gotoMainMenu(Graphics graphics) {
      //clear screen to black colour
      //draw the main menu


      //if i press the fire button the game will start again
      int keyState = getKeyStates();
      if ( (keyState & FIRE_PRESSED) != 0 ){
      System.out.println("game start");
      gameOverState = false;

      The problem i am facing is :
      the FIRE button is not functioning, i put a system.out.println and it didnt print.
      i am unsure whether i put the key input listener at the correct function
      this button is supposed to start the game again.

      What i want to do :
      i want to display the main menu when i launched the game
      when game is over, it will display back to the main menu again
      when i press the fire button it will play the game again.

      i hope someone can help me on this :)