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

📄 frozenbubble.java

📁 本代码为java编写的泡泡龙游戏
💻 JAVA
字号:

//本类是主类,进行初始化功能
public class FrozenBubble extends GameApplet
{
	//定义相应事件所对应的声音
	public final static int SOUND_WON = 0;
	public final static int SOUND_LOST = 1;
	public final static int SOUND_LAUNCH = 2;
	public final static int SOUND_DESTROY = 3;
	public final static int SOUND_REBOUND = 4;
	public final static int SOUND_STICK = 5;
	public final static int SOUND_HURRY = 6;
	public final static int SOUND_NEWROOT = 7;
	public final static int SOUND_NOH = 8;
	public final static int SOUND_TYPEWRITER = 9;
	
	private final static String[] SOUND_FILES = {"applause.au","lose.au","launch.au","destroy_group.au", "rebound.au", "stick.au", 
												 "hurry.au", "newroot_solo.au", "noh.au","typewriter.au"};
	
    public final static int GAME_NORMAL = 0;
    public final static int GAME_COLORBLIND = 1;
                                                                                                 
    private static int gameMode;
                                                                                                 
	public void gameInit()
	{
		//游戏级别管理对象
		LevelManager levelManager = new LevelManager(this.getGameMedia().loadData("levels.txt"));
		this.getGameContext().addObject("levelManager", levelManager);
		
		//游戏声音管理对象
		SoundManager soundManager = new SoundManager(this, SOUND_FILES);
		this.getGameContext().addObject("soundManager", soundManager);
		
		//游戏字体
		BubbleFont bubbleFont = new BubbleFont(this);
		this.getGameContext().addObject("bubbleFont", bubbleFont);
		
		//游戏生命周期管理对象
		LifeManager lifeManager = new LifeManager(this);
		this.getGameContext().addObject("lifeManager", lifeManager);
		
		//游戏最高分记录管理对象
		HighscoreManager highscoreManager = new HighscoreManager(this);
		this.getGameContext().addObject("highscoreManager", highscoreManager);
                
		// Init current mode
        this.setMode(GAME_NORMAL);
                
        // 用户来预处理,以准备泡泡发射器的图片
		new LaunchBubbleSprite(this, 0, 0);
	}
        
    public static void switchMode() 
    {
        if (gameMode == GAME_COLORBLIND) 
        {
            gameMode = GAME_NORMAL;
        }
        else 
        {
            gameMode = GAME_COLORBLIND;
        }
    }
    
    public static void setMode(int newMode) 
    {
        gameMode = newMode;
    }
    
    public static int getMode() 
    {
        return gameMode;
    }
	
        
	public GameScreen getInitialScreen()
	{
		return new SplashScreen(this);
	}
	
	public boolean needsMouseEvents()
	{
		return false;
	}	

   public static void main(String[] args) 
   {
       new AppletFrame("Java的泡泡游戏", new FrozenBubble(), 640, 480);            
   }
}

⌨️ 快捷键说明

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