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

📄 level.java

📁 Critter_Crunch_J2ME 游戏源
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
   public static final int         INTRO_SPEED          = 30;                       // speed of level intro wipe in
   public static final int         INTRO_DISPLAY_TIME   = 10;                       // time to display the level intro text
   public static final int         BG_TYPE_OFFSET       = TYPE_MAINMENU;            // offset for background index of current type.
   //#if DefaultConfiguration || Nokia_6600 || Nokia_6600_Unobfuscated || Razr
   public static final int         BG_ADVENTURE_DIVISOR = 6;                        // divisor for how often backgrounds change in adventure mode.
   //#else
//#    public static final int         BG_ADVENTURE_DIVISOR = 8;                        // divisor for how often backgrounds change in adventure mode.
   //#endif
   public static final int         BG_SKY               = 13;                       // index id of the score summary sky background.
   public static final int         TOTAL_COMBOS_MULTIPLIER     = 5;                 // points multiplier for total combos
   public static final int         LONGEST_COMBO_MULTIPLIER    = 25;                // points multiplier for longest combo
   public static final int         JEWELS_CAUGHT_MULTIPLIER    = 10;                // points multiplier for jewels caught
   public static final int         LEFTOVER_AMMO_MULTIPLIER    = 50;                // points multiplier for leftover ammo
   public static final int         LEFTOVER_MOVES_MULTIPLIER   = 250;               // points multiplier for leftover moves
   public static final int         TIME_LEFT_MULTIPLIER        = 50;                // points multiplier for time left
   public static final int         SPEEDUPS_MULTIPLIER         = 5000;              // points multiplier for survival speed ups
   // BG types
   public static final short       BG_TYPE_IMAGE        = 1;                        // BG type -- image
   public static final short       BG_TYPE_IMAGE_TILED  = 2;                        // BG type -- image that tiles horizontally
   public static final short       BG_TYPE_SOLID        = 3;                        // BG type -- solid fill
   public static final short       BG_TYPE_GRADIENT_V   = 4;                        // BG type -- vertical gradient fill
   public static final short       BG_TYPE_GRADIENT_H   = 5;                        // BG type -- horizontal gradient fill
   public static final short       BG_TYPE_SUNBEAM      = 6;                        // BG type -- animated sun beam
   public static final short       BG_TYPE_VINES        = 7;                        // BG type -- vines
   public static final short       BG_TYPE_SUN          = 8;                        // BG type -- sun
   public static final short       BG_TYPE_CLOUD        = 9;                        // BG type -- drifting cloud
   // BG layers
   public static final short       BG_LAYER_BACK        = 0;                        // BG layer -- back
   public static final short       BG_LAYER_MID         = 1;                        // BG layer -- middle
   public static final short       BG_LAYER_FRONT       = 2;                        // BG layer -- foreground
   // BG common indices
   public static final short       BG_TYPE              = 0;                        // BG index -- BG type.
   public static final short       BG_LAYER             = 1;                        // BG index -- BG layer.
   public static final short       BG_X                 = 2;                        // BG index -- BG x position.
   public static final short       BG_Y                 = 3;                        // BG index -- BG y position.
   // BG_TYPE_IMAGE specific indices
   public static final short       BG_FRAMES            = 4;                        // BG index -- amount of frames for this image.
   public static final short       BG_COORD             = 5;                        // BG index -- first frame's coordinate value.
   // BG_TYPE_SOLID, BG_TYPE_GRADIENT_V and BG_TYPE_GRADIENT_H specific indices
   public static final short       BG_WIDTH             = 4;                        // BG index -- fill's width.
   public static final short       BG_HEIGHT            = 5;                        // BG index -- fill's height.
   public static final short       BG_R_1               = 6;                        // BG index -- fill's first RGB red value.
   public static final short       BG_G_1               = 7;                        // BG index -- fill's first RGB green value.
   public static final short       BG_B_1               = 8;                        // BG index -- fill's first RGB blue value.
   public static final short       BG_R_2               = 9;                        // BG index -- fill's second RGB red value.
   public static final short       BG_G_2               = 10;                       // BG index -- fill's second RGB green value.
   public static final short       BG_B_2               = 11;                       // BG index -- fill's second RGB blue value.
   // BG_TYPE_SUNBEAM specific indices
   //public static final short       BG_WIDTH             = 4;                      // BG index -- sun beam's max width.
   public static final short       BG_RANGE             = 5;                        // BG index -- sun beam's horizontal range of motion
   //public static final short       BG_R_1               = 6;                      // BG index -- sun beam's RGB red value.
   //public static final short       BG_G_1               = 7;                      // BG index -- sun beam's RGB green value.
   //public static final short       BG_B_1               = 8;                      // BG index -- sun beam's RGB blue value.
   public static final short       BG_WIDTH_FREQ        = 9;                        // BG index -- sun beam's width cycling frequency.
   public static final short       BG_RANGE_FREQ        = 10;                       // BG index -- sun beam's horizontal motion frequency.
   // BG_TYPE_CLOUD specific indices
   public static final short       BG_SPEED_FRACTION    = 4;                        // BG index -- cloud's drifting speed (how many ticks it takes to travel 1 pixel).
   //public static final short       BG_COORD             = 5;                      // BG index -- cloud's sprite index.
   //#if DefaultConfiguration || Nokia_6600 || Nokia_6600_Unobfuscated || Razr
   public static final int         BG_GRADIENT_LEVELS   = 5;                        // resolution of bg gradient fills
   public static final int         BG_SUN_FACE_X_OFFSET = 3;
   public static final int         BG_SUN_FACE_Y_OFFSET = 2;
   public static final int         BG_SUN_ANIM_PERIOD   = 50;
   public static final int         BG_SUN_ANIM_LENGTH   = 20;
   //#else
//#    public static final int         BG_GRADIENT_LEVELS   = 3;                        // resolution of bg gradient fills
   //#endif
   //#ifndef NO_BOARD_BUMPS
   public static final int         BUMP_SIZE            = 0;                        // index of pixel offset for a column's bump.
   public static final int         BUMP_DIRECTION       = 1;                        // index of a column's bump direction.
   public static       byte        BUMP_OFFSET;                                     // size of each bump interval.
   public static       byte        MAX_BUMP_OFFSET;                                 // maximum pixel offset for board bumps.
   //#endif
   public static final int         SCORE_ENTRIES        = 8;                        // length of each top-score list.
   public static final int         SCORE_EVENTS         = 3;                        // amount of events with a top-ten list.
   public static final int         SCORE_SIZE           = SCORE_ENTRIES *
                                                          SCORE_EVENTS;             // total size of all top scores.
   public static final int         SCORE_ADVENTURE      = SCORE_ENTRIES * 0;        // index of adventure scores.
   public static final int         SCORE_TIMETRIAL      = SCORE_ENTRIES * 1;        // index of time trial scores.
   public static final int         SCORE_SURVIVAL       = SCORE_ENTRIES * 2;        // index of survival scores.
   public static       int []      S_SCORE_VALUES       = new int[SCORE_SIZE];      // array holding all of the top scores.
   public static       int []      S_SCORE_NAMES        = new int[SCORE_SIZE];      // array holding all the top scorer names.
   public static       boolean []  S_COMPLETED_PUZZLES  = new boolean[PUZZLE_COUNT];// array that keeps track of which puzzle levels have been unlocked.
   public static final int         UNLOCK_PUZZLES_1     = 4;                        // level number for puzzles unlock #1.
   public static final int         PUZZLES_AREA_1       = 10;                       // number of puzzle levels to unlock on first achievement.
   public static final int         UNLOCK_PUZZLES_2     = 16;                       // level number for puzzles unlock #2.
   public static final int         PUZZLES_AREA_2       = 16;                       // number of puzzle levels to unlock on second achievement.
   public static final int         UNLOCK_PUZZLES_3     = 19;                       // level number for puzzles unlock #3.
   public static final int         PUZZLES_AREA_3       = 27;                       // number of puzzle levels to unlock on third achievement.
   public static final int         UNLOCK_PUZZLES_4     = 23;                       // level number for puzzles unlock #4.
   public static final int         PUZZLES_AREA_4       = 45;                       // number of puzzle levels to unlock on fourth achievement.
   public static final int         UNLOCK_PUZZLES_5     = 30;                       // level number for puzzles unlock #5.
   public static final int         PUZZLES_AREA_5       = PUZZLE_COUNT;             // number of puzzle levels to unlock on fifth achievement.
   public static final int         UNLOCK_TIMETRIAL_1   = 25;                       // level number for timetrial unlock #1.
   public static final int         TIMETRIAL_AREA_1     = TIMETRIAL_COUNT;          // number of time trial levels to unlock on first achievement.
   public static final int         UNLOCK_SURVIVAL      = 34;                       // level number for survival unlock.
   public static final int         TIME_GROUND_POUND    = TOTFC.FRAMES_PER_SECOND;  // amount of time required to pound the ground and drop the board by one row.



   /****************************************************************************
    ** Variables
    ***************************************************************************/

   public static       byte         s_main_type;                                   // level type selected from the main menu.
   public static       byte         s_next_type;                                   // type of the next level.
   public static       byte         s_next_number;                                 // number of the next level.
   public static       byte         s_extra_type;                                  // level's extra type in adventure mode.
   public static       byte         s_type;                                        // type of this level.
   public static       byte         s_state;                                       // logical state(s) of the level.
   public static       int          s_board_state;                                 // logical state of the game board.
   public static       byte         s_number;                                      // id number of the current level.
   public static       byte         s_adventure_number;                            // last adventure level.
   public static       byte         s_puzzle_number;                               // last puzzle level.
   public static       byte         s_timetrial_number;                            // last time trial level.
   public static       byte         s_puzzles_unlocked;                            // number of puzzle levels unlocked.
   public static       byte         s_timetrial_unlocked;                          // number of time trial levels unlocked.
   public static       byte         s_survival_unlocked;                           // number of survival levels unlocked.
   public static       boolean      s_paused;                                      // flag for pausing the level.
   public static       int          s_clock;                                       // level's timer.
   public static       byte         s_board_padding;                               // amount of rows that the level begins with.
   public static       int          s_current_score;                               // the player's current score.
   public static       int          s_last_score;                                  // player's score since last level.
   public static       int          s_adventure_score;                             // player's last adventure mode score.
   public static       int          s_timetrial_score;                             // player's last time trial mode score.
   public static       int          s_survival_score;                              // score for survival mode.
   public static       int          s_level_bar;                                   // keeps track of bugs popped.
   public static       int          s_level_bar_goal;                              // goal for passing the level.
   public static       int          s_level_bar_height;                            // actual height of the goal bar for the current level type.
   public static       byte         s_background;                                  // id of the current background type to be used.
   public static       byte         s_original_background;                         // original background type for this level.
   public static       byte         s_background_frame;                            // frame of an animated background component.
   public static       short [][][] s_backgrounds;                                 // composition of all the game's backgrounds.
   public static       byte []      s_chance_creatures;                            // array listing ids of creatures, with each index representing a possible chance to get that creature.
   public static       byte []      s_chance_items;                                // array listing ids of items, with each index representing a possible chance to get that item.
   public static       Critter [][] s_board;                                       // 2D array of Critters.
   public static       Critter [][] s_board_backup;                                // temporary backup of the above board.
   public static       int [][]     s_board_bumps;                                 // array holding board offsets for Critter bumps.
   public static       Critter []   s_extras;                                      // array of extra entities.
   public static       short        s_board_x;                                     // x coordinate of the board.
   public static       short        s_board_y;                                     // y coordinate of the board.
   public static       byte         s_board_offset_total;                          // total offset of board since descent started.
   public static       byte         s_board_offset;                                // board descent offset for the current tick.
   public static       int          s_board_timer;                                 // timer that dictates when Critters come down.
   public static       int          s_board_timer_full;                            // number the above timer gets reset to after the countdown.
   public static       int          s_board_timer_original;                        // initial timer given to the level without any speedup/slowdown offsets.
   public static       int          s_board_timer_delay;                           // delay for checking the board's ascend/descend timer.
   public static       int          s_board_timer_bonus;                           // delay for adding/removing bonus creatures.
   public static       int          s_board_timer_bonus_original;                  // original timer of bonus creatures.
   public static       byte         s_creature_count;                              // total amount of creatures currently on the board.
   public static       byte         s_greens;                                      // green creature counter.
   public static       byte         s_reds;                                        // red creature counter.
   public static       byte         s_blues;                                       // blue creature counter.
   public static       byte         s_oranges;                                     // chance that an orange might appear.
   public static       byte         s_purples;                                     // change that a purple might appear.
   public static       byte         s_specials;                                    // special creatures counter.
   public static       byte         s_special_last;                                // id of last generated special creature.
   public static       byte         s_special_interval;                            // amount of non-special creatures that were generated since the last special creature.
   public static       byte         s_combo;                                       // number of creatures in the current combo.
   public static       byte         s_longest_combo;                               // longest combo a player performs in a level.
   public static       short        s_total_combos;                                // total number of combos completed in a level.
   public static       short        s_coin_timer;                                  // timer for a spinning Biggs coin.
   public static       short        s_coin_frame;                                  // animation frame of the spinning coin.
   public static       byte         s_jewel_board_offset;                          // board x offset for next jewel.
   public static       byte         s_jewel_column;                                // board x of the next bonus jewel dropped.
   public static       short        s_total_jewels_caught;                         // total amount of jewels that were caught in the level.
   public static       Avatar       s_player;                                      // reference to Biggs, the player avatar.
   public static       byte         s_hold_down;                                   // counter for holding the controls down.
   public static       boolean      s_stepthrough;                                 // flag for initiating debug-like step-through of the level-loop, making it pause after every tick.
   public static       boolean      s_game_win;                                    // flag indicating game complete.
   public static       boolean      s_lose_sequence;                               // flag indicating if we need to play the lose animation.
   public static       int          s_vines_rgb;                                   // current rgb of the procedural vines



   /****************************************************************************
    ** 'tors
    ***************************************************************************/

   // class initializer.
   public static void poke() { Thread.yield(); }

   // default Level constructor.
   private Level() { }

   // level initializer.
   public static void init(int type, int number, int score) {

      Particles.clear();
      Engine.gc();

      Engine.printLine("Level init, type: " + type + ", number: " + number);

⌨️ 快捷键说明

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