2012年5月27日 星期日

Java & Slick 遊戲開發(6)- How to Make Screens



  1. 你的Package中創建新的Class
  2. 一個叫Play,另一個叫Menu 
  3. Run Program會有一個黑色的畫面

The Code:Play.class



package javagame;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Play extends BasicGameState
{
public Play(int State)
{
}
public void init(GameContainer gc,StateBasedGame sbg) throws SlickException
{
}
public void render(GameContainer gc,StateBasedGame sbg, Graphics g) throws SlickException
{
}
public void update(GameContainer gc,StateBasedGame sbg, int delta) throws SlickException
{
}
public int getID()
{
return 1;
}

}

The Code:Menu.class


package javagame;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Menu extends BasicGameState
{
public Menu(int State)
{
}
public void init(GameContainer gc,StateBasedGame sbg) throws SlickException
{
}
public void render(GameContainer gc,StateBasedGame sbg, Graphics g) throws SlickException
{
}
public void update(GameContainer gc,StateBasedGame sbg, int delta) throws SlickException
{
}
public int getID()
{
return 0;
}

}


沒有留言:

張貼留言