?? level.java
字號:
import java.awt.*;
//the level class on server side
//since there will only be one level object, so everything in this class is a static variable
public class level{
public static int currentLevel = 8;
public static int enemySpawnTime = 150;
public static int enemyLeft = 20;
public static int deathCount = 0;
public static int maxNoEnemy = 3;
public static int NoOfEnemy = 0;
public static int[] enemySequence;
//variables to help make up winning scene
public static int winningCount;
public static void loadLevel(ServerModel gameModel){
//increase the level number
currentLevel++;
//incease the difficulty each time load a new level
if(enemySpawnTime > 30)
enemySpawnTime-=10;
if(maxNoEnemy < 10 && (currentLevel%2 == 0))
maxNoEnemy++;
//clear all the stuff from previous level
for(int i = 0; i < 400; i ++)
gameModel.actors[i] = null;
//initiate varibriables share by all levels
enemyLeft = 20;
//load base (same every level)
gameModel.actors[0] = new wall(248, 498, 2, gameModel);
gameModel.actors[1] = new wall(273, 498, 3, gameModel);
gameModel.actors[2] = new wall(248, 473, 1, gameModel);
gameModel.actors[3] = new wall(273, 473, 1, gameModel);
gameModel.actors[4] = new base(gameModel);
//load one level
if(1+ (currentLevel-1)%8 == 1){
enemySequence = new int[]{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2};
String[] level = new String[]{
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "ss", "ss", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"s0", "##", "##", "__", "__", "__", "__", "__", "##", "s0", "s0", "##", "__", "__", "__", "__", "__", "##", "##", "s0",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "##", "##", "__", "__", "__", "__", "__", "##", "__", "__", "##", "__", "__", "__", "__", "__", "##", "##", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__"
};
loadLevel(gameModel, level);
}
if(1+ (currentLevel-1)%8 == 2){
enemySequence = new int[]{1,1,2,2,1,1,1,1,2,2,2,2,1,1,1,1,3,3,3,3};
String[] level = new String[]{
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$",
"$$", "==", "==", "==", "==", "==", "==", "==", "$$", "$$", "==", "==", "==", "==", "==", "==", "==", "==", "==", "$$",
"$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "ss", "##", "##", "##", "##", "##", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "ss", "##", "##", "##", "__", "__", "ss", "ss", "##", "##", "##", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "##", "__", "__", "__", "__", "__", "__", "##", "__", "__", "__", "__", "__", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "__", "__", "__", "__", "__", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "__", "__", "__", "__", "__", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "##", "##", "##", "##", "##", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "##", "##", "##", "##", "##", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "##", "##", "##", "##", "##", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "##", "##", "##", "##", "##", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "##", "##", "##", "##", "##", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "__", "__", "__", "__", "__", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "__", "__", "__", "__", "__", "##", "==", "==", "==", "==", "==", "__",
"__", "$$", "$$", "$$", "$$", "$$", "##", "__", "__", "__", "__", "__", "__", "##", "==", "==", "==", "==", "==", "__"
};
loadLevel(gameModel, level);
}
if(1+ (currentLevel-1)%8 == 3){
enemySequence = new int[]{1,1,1,2,2,2,4,4,2,2,2,2,1,1,1,1,2,2,4,4};
String[] level = new String[]{
"__", "__", "__", "ss", "__", "__", "ss", "__", "__", "__", "__", "__", "__", "__", "__", "__", "s3", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "ss", "##", "##", "##", "__", "##", "##", "##", "##", "__", "s3", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "s3", "__", "__", "__",
"__", "__", "ss", "ss", "__", "##", "##", "##", "##", "__", "__", "##", "##", "__", "##", "##", "##", "__", "__", "__",
"__", "__", "__", "ss", "__", "##", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "##", "__", "##", "s1",
"__", "__", "__", "ss", "__", "##", "__", "ss", "##", "ss", "##", "ss", "##", "##", "##", "##", "##", "__", "__", "##",
"__", "__", "__", "ss", "__", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "__", "__", "__",
"__", "__", "__", "ss", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "__", "__", "__",
"__", "__", "__", "##", "ss", "ss", "ss", "ss", "##", "##", "##", "##", "##", "$$", "$$", "$$", "$$", "##", "##", "##",
"##", "__", "__", "##", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "__", "__", "__",
"##", "##", "__", "##", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "__", "__", "__",
"##", "##", "##", "##", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "##", "##", "##", "##", "##", "__", "__", "__",
"##", "##", "##", "##", "##", "##", "$$", "##", "$$", "##", "$$", "$$", "$$", "$$", "$$", "##", "__", "__", "__", "__",
"##", "##", "##", "##", "$$", "$$", "$$", "$$", "$$", "##", "$$", "$$", "$$", "$$", "$$", "##", "__", "__", "__", "__",
"#0", "s0", "s0", "s0", "$$", "ss", "ss", "ss", "ss", "##", "ss", "ss", "$$", "ss", "ss", "##", "##", "##", "ss", "##",
"__", "__", "__", "##", "__", "__", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "##",
"__", "__", "__", "##", "__", "__", "__", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$",
"__", "__", "__", "##", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "##", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "##", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__"
};
loadLevel(gameModel, level);
}
if(1+ (currentLevel-1)%8 == 4){
enemySequence = new int[]{3,3,3,3,2,2,2,3,3,1,1,1,3,3,3,1,1,4,4,4};
String[] level = new String[]{
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "__", "__", "__", "__", "__",
"__", "__", "__", "##", "##", "##", "##", "##", "##", "##", "##", "##", "ss", "##", "##", "##", "##", "__", "__", "__",
"__", "__", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "ss", "ss", "s2", "__", "__",
"__", "__", "##", "##", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$","$$", "$$", "$$", "$$", "$$", "s2", "__", "__",
"__", "__", "##", "##", "##", "$$", "$$", "$$", "$$", "$$", "##", "$$", "$$", "$$", "$$", "$$", "$$", "s2", "__", "__",
"__", "##", "##", "##", "##", "##", "$$", "$$", "$$", "##", "$$", "##", "$$", "$$", "$$", "$$", "$$", "s2", "__", "__",
"__", "##", "##", "##", "##", "##", "$$", "$$", "##", "$$", "$$", "$$", "##", "$$", "$$", "$$", "$$", "s2", "__", "__",
"__", "##", "##", "##", "##", "##", "$$", "##", "$$", "$$", "$$", "$$", "$$", "##", "$$", "$$", "$$", "s2", "__", "__",
"__", "##", "##", "##", "##", "##", "$$", "$$", "##", "$$", "$$", "$$", "##", "$$", "$$", "$$", "$$", "s2", "__", "__",
"__", "##", "##", "##", "##", "$$", "$$", "$$", "$$", "##", "$$", "##", "$$", "$$", "$$", "$$", "##", "s2", "__", "__",
"__", "__", "##", "##", "$$", "$$", "$$", "$$", "$$", "$$", "##", "$$", "$$", "$$", "$$", "$$", "##", "##", "__", "__",
"__", "__", "##", "$$", "$$", "$$", "$$", "$$", "$$", "##", "##", "$$", "$$", "$$", "$$", "##", "##", "s0", "s0", "s0",
"__", "__", "##", "##", "##", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "$$", "##", "##", "__", "__", "__", "__",
"__", "__", "__", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "##", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__"
};
loadLevel(gameModel, level);
}
if(1+ (currentLevel-1)%8 == 5){
enemySequence = new int[]{2,2,2,3,3,3,2,2,2,4,4,4,3,3,3,3,3,2,2,2};
String[] level = new String[]{
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "==", "__", "__", "__", "__", "__", "__",
"__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__",
"__", "==", "==", "==", "__", "__", "==", "==", "==", "==", "==", "==", "__", "==", "==", "==", "==", "==", "==", "__",
"__", "==", "ss", "__", "__", "__", "__", "==", "__", "__", "__", "__", "__", "__", "__", "__", "__", "__", "==", "__",
"__", "==", "__", "__", "__", "__", "__", "==", "__", "==", "==", "__", "ss", "==", "==", "==", "==", "__", "==", "__",
"__", "==", "__", "==", "==", "==", "==", "==", "__", "==", "__", "__", "==", "__", "__", "==", "__", "__", "==", "__",
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -