Esempio n. 1
0
  public GameState(Specular game) {
    super(game);

    // Loading map texture from a internal directory
    Texture mapTexture = new Texture(Gdx.files.internal("graphics/game/packed/Level.png"));
    Texture shockLight = new Texture(Gdx.files.internal("graphics/game/packed/ShockLight.png"));
    Texture parallax = new Texture(Gdx.files.internal("graphics/game/packed/Parallax.png"));

    // Loading gameover textures
    gameOverTex = new Texture(Gdx.files.internal("graphics/game/packed/Background.png"));
    newHighscore = new Texture(Gdx.files.internal("graphics/menu/gameover/New Highscore.png"));

    // Loading pause menu textures
    pauseTex = new Texture(Gdx.files.internal("graphics/menu/pausemenu/Pause.png"));
    greyPixel = new Texture(Gdx.files.internal("graphics/menu/pausemenu/Grey Pixel.png"));

    textureAtlas = new TextureAtlas(Gdx.files.internal("graphics/game/packed/Specular.atlas"));

    // Loading HUD
    hud = new HUD(this);

    // Initializing map handler for handling many maps
    mapHandler = new MapHandler();
    mapHandler.addMap(
        "Map",
        mapTexture,
        shockLight,
        parallax,
        mapTexture.getWidth(),
        mapTexture.getHeight(),
        this);
    currentMap = mapHandler.getMap("Map");

    clipBounds = new Rectangle(0, 0, currentMap.getWidth(), currentMap.getHeight());

    // Initializing font
    FreeTypeFontGenerator fontGen =
        new FreeTypeFontGenerator(Gdx.files.internal("fonts/Battlev2l.ttf"));
    FreeTypeFontParameter ftfp = new FreeTypeFontParameter();
    ftfp.size = 96; // MAX SIZE
    ftfp.characters = "1234567890,";
    gameOverScoreFont = fontGen.generateFont(ftfp);
    gameOverScoreFont.setColor(Color.RED);

    ftfp.characters = "1234567890,tapocniue"; // Characters for "Tap to continue"
    ftfp.size = 64;
    scoreFont = fontGen.generateFont(ftfp);
    scoreFont.setColor(Color.RED);

    ftfp.characters = "1234567890,x";
    ftfp.size = 40;
    multiplierFont = fontGen.generateFont(ftfp);
    multiplierFont.setColor(Color.RED);

    // Tutorial (Must be initialized before fontGen.dispose())
    tutorial = new Tutorial(this, fontGen);

    fontGen.dispose();
    // Graphics Settings
    GfxSettings.init();

    // Tutorial
    Tutorial.init(textureAtlas);

    // Initializing entities and analogstick statically
    Player.init(textureAtlas);
    Bullet.init(this);
    Particle.init(textureAtlas);
    UpgradeOrb.init(textureAtlas);
    EnemyWanderer.init(textureAtlas);
    EnemyCircler.init(textureAtlas);
    EnemyStriver.init(textureAtlas);
    EnemyBooster.init(textureAtlas);
    EnemyWorm.init(textureAtlas);
    EnemyVirus.init(textureAtlas);
    EnemyShielder.init(textureAtlas);
    EnemyExploder.init(textureAtlas);
    EnemyDasher.init(textureAtlas);
    EnemyTanker.init(textureAtlas);
    AnalogStick.init(hud);

    // Initializing power-ups
    AddLife.init(textureAtlas);
    BulletBurst.init(textureAtlas);
    FireRateBoost.init(textureAtlas);
    ScoreMultiplier.init(textureAtlas);
    ShieldPowerUp.init(textureAtlas);
    SlowdownEnemies.init(textureAtlas);
    BoardshockPowerUp.init(textureAtlas);
    Ricochet.init(textureAtlas);
    Repulsor.init(textureAtlas);
    LaserPowerup.init(textureAtlas);
    ShockWaveRenderer.init(textureAtlas);
    Laser.init(this);
    Swarm.init(textureAtlas);
    PDSPowerUp.init(textureAtlas);

    pss = new PlayerSpawnSystem(this);
    puss = new PowerUpSpawnSystem(this);
    pass = new ParticleSpawnSystem(this);
    oss = new OrbSpawnSystem(this);
    cs = new ComboSystem();
    waveManager = new WaveManager(this);

    input = Gdx.input;
  }