Package com.palepail.TestGame.Levels

Source Code of com.palepail.TestGame.Levels.Level

package com.palepail.TestGame.Levels;

import java.util.HashMap;

import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.palepail.TestGame.Enemies.Enemy;
import com.palepail.TestGame.Enemies.Follower;
import com.palepail.TestGame.Enemies.FollowerDoubleShot;
import com.palepail.TestGame.Enemies.FollowerLerp;
import com.palepail.TestGame.Enemies.FollowerSplit;
import com.palepail.TestGame.Enemies.LargeEnemy;
import com.palepail.TestGame.Enemies.LargeEnemyBurst;
import com.palepail.TestGame.Enemies.LargeEnemySplit;
import com.palepail.TestGame.Enemies.LargeEnemySquiggle;
import com.palepail.TestGame.Enemies.Shooter;
import com.palepail.TestGame.Enemies.ShooterSingle;
import com.palepail.TestGame.Enemies.ShooterSplit;
import com.palepail.TestGame.Enemies.ShooterSquiggle;
import com.palepail.TestGame.Utilities.Configuration;

/*the level class is the abstract framework for the level object. this stores information such as the music,
*  background, name, and most importantly the enemy queue and queue times.*/

public abstract class Level {

  protected Level nextLevel;

  protected static HashMap<String, TextureRegion> textures = new HashMap<String, TextureRegion>();
  protected static HashMap<String, Animation> animations = new HashMap<String, Animation>();
  protected Array<Enemy> enemyQueue = new Array<Enemy>();
  protected Array<Integer> enemyTimes = new Array<Integer>();
  // music for the level
  String bgm;
  String bgmName;

  // name of the level
  String name;

  public static int WAIT_FOR_ENEMIES = -1;
  public static int WAIT_FOR_ENEMY_BULLETS = -2;
  public static int VICTORY = -99;

  public Level getNextLevel() {
    return nextLevel;
  }

  protected Shooter getShooterSingle(Vector2 spawnPoint, int cooldown, float fireRate, String variation) {
    return new ShooterSingle(1f * Configuration.gameScale, 0, 1f * Configuration.gameScale,
        1f * Configuration.gameScale, spawnPoint, cooldown, fireRate, variation, ShooterSingle.BASE_HEALTH);
  }

  protected Shooter getShooterSplit(Vector2 spawnPoint, int cooldown, float fireRate, String variation) {
    return new ShooterSplit(1f * Configuration.gameScale, 0, 1f * Configuration.gameScale,
        1f * Configuration.gameScale, spawnPoint, cooldown, fireRate, variation, ShooterSplit.BASE_HEALTH);
  }

  protected Shooter getShooterSquiggle(Vector2 spawnPoint, int cooldown, float fireRate, String variation) {
    return new ShooterSquiggle(1f * Configuration.gameScale, 0, 1f * Configuration.gameScale,
        1f * Configuration.gameScale, spawnPoint, cooldown, fireRate, variation, ShooterSquiggle.BASE_HEALTH);
  }

  protected Shooter getShooterSingle(int x, int y, int cooldown, float fireRate, String variation) {
    Vector2 spawnPoint = new Vector2(x * Configuration.gameScale, y * Configuration.gameScale);
    return getShooterSingle(spawnPoint, cooldown, fireRate, variation);
  }

  protected Shooter getShooterSquiggle(int x, int y, int cooldown, float fireRate, String variation) {
    Vector2 spawnPoint = new Vector2(x * Configuration.gameScale, y * Configuration.gameScale);
    return getShooterSquiggle(spawnPoint, cooldown, fireRate, variation);
  }

  protected Shooter getShooterSplit(int x, int y, int cooldown, float fireRate, String variation) {
    Vector2 spawnPoint = new Vector2(x * Configuration.gameScale, y * Configuration.gameScale);
    return getShooterSplit(spawnPoint, cooldown, fireRate, variation);
  }

  protected Follower getFollowerLerp(Vector2 spawnPoint, int cooldown, float firerate, String variation) {
    return new FollowerLerp(10f * Configuration.gameScale, 0, 2.5f * Configuration.gameScale,
        2.5f * Configuration.gameScale, spawnPoint, cooldown, firerate, variation, FollowerLerp.BASE_HEALTH);
  }

  protected Follower getFollowerLerp(int x, int y, int cooldown, float firerate, String variation) {
    return getFollowerLerp(new Vector2(x * Configuration.gameScale, y * Configuration.gameScale), cooldown,
        firerate, variation);
  }

  protected Follower getFollowerDoubleShot(Vector2 spawnPoint, int cooldown, float firerate, String variation) {
    return new FollowerDoubleShot(10f * Configuration.gameScale, 0, 2.5f * Configuration.gameScale,
        2.5f * Configuration.gameScale, spawnPoint, cooldown, firerate, variation, FollowerLerp.BASE_HEALTH);

  }

  protected Follower getFollowerDoubleShot(int x, int y, int cooldown, float firerate, String variation) {
    return getFollowerDoubleShot(new Vector2(x * Configuration.gameScale, y * Configuration.gameScale), cooldown,
        firerate, variation);
  }

  protected FollowerSplit getFollowerSplit(Vector2 spawnPoint, int cooldown, float firerate, String variation,
      int timesToSplit) {
    return new FollowerSplit(10f * Configuration.gameScale, 0, 2.5f * Configuration.gameScale,
        2.5f * Configuration.gameScale, spawnPoint, cooldown, firerate, variation, timesToSplit, true,
        FollowerSplit.BASE_HEALTH);
  }

  protected Follower getFollowerSplit(int x, int y, int cooldown, float firerate, String variation, int timesToSplit) {
    return getFollowerSplit(new Vector2(x * Configuration.gameScale, y * Configuration.gameScale), cooldown,
        firerate, variation, timesToSplit);
  }

  protected LargeEnemy getLargeEnemyBurst(Vector2 spawnPoint, int cooldown, float fireRate, String variation) {
    return new LargeEnemyBurst(10f * Configuration.gameScale, 0, 2f * Configuration.gameScale,
        2f * Configuration.gameScale, spawnPoint, cooldown, fireRate, variation, LargeEnemyBurst.BASE_HEALTH);
  }

  protected LargeEnemy getLargeEnemyBurst(int x, int y, int cooldown, float fireRate, String variation) {
    Vector2 spawnPoint = new Vector2(x * Configuration.gameScale, y * Configuration.gameScale);
    return getLargeEnemyBurst(spawnPoint, cooldown, fireRate, variation);

  }

  protected LargeEnemy getLargeEnemySquiggle(Vector2 spawnPoint, int cooldown, float fireRate, String variation) {
    return new LargeEnemySquiggle(10f * Configuration.gameScale, 0, 2f * Configuration.gameScale,
        2f * Configuration.gameScale, spawnPoint, cooldown, fireRate, variation, LargeEnemyBurst.BASE_HEALTH);
  }

  protected LargeEnemy getLargeEnemySquiggle(int x, int y, int cooldown, float fireRate, String variation) {
    Vector2 spawnPoint = new Vector2(x * Configuration.gameScale, y * Configuration.gameScale);
    return getLargeEnemySquiggle(spawnPoint, cooldown, fireRate, variation);

  }

  protected LargeEnemy getLargeEnemySplit(Vector2 spawnPoint, int cooldown, float fireRate, String variation) {
    return new LargeEnemySplit(10f * Configuration.gameScale, 0, 2f * Configuration.gameScale,
        2f * Configuration.gameScale, spawnPoint, cooldown, fireRate, variation, LargeEnemyBurst.BASE_HEALTH);
  }

  protected LargeEnemy getLargeEnemySplit(int x, int y, int cooldown, float fireRate, String variation) {
    Vector2 spawnPoint = new Vector2(x * Configuration.gameScale, y * Configuration.gameScale);
    return getLargeEnemySplit(spawnPoint, cooldown, fireRate, variation);

  }

  public TextureRegion getTexture(String key) {

    return textures.get(key);
  }

  public Animation getAnimation(String key) {

    return animations.get(key);
  }

  /**
   * @return the bgmName
   */
  public String getBgmName() {

    return bgmName;
  }

  /**
   * @param bgmName
   *            the bgmName to set
   */
  public void setBgmName(String bgmName) {
    this.bgmName = bgmName;
  }

  /**
   * @return the name
   */
  public String getName() {
    return name;
  }

  /**
   * @param name
   *            the name to set
   */
  public void setName(String name) {
    this.name = name;
  }

  /**
   * @return the bgm
   */
  public String getBgm() {
    return bgm;
  }

  /**
   * @param bgm
   *            the bgm to set
   */
  public void setBgm(String bgm) {
    this.bgm = bgm;
  }

  /**
   * @return the enemyQueue
   */
  public Array<Enemy> getEnemyQueue() {
    return enemyQueue;
  }

  /**
   * @param enemyQueue
   *            the enemyQueue to set
   */
  public void setEnemyQueue(Array<Enemy> enemyQueue) {
    this.enemyQueue = enemyQueue;
  }

  /**
   * @return the enemyTimes
   */
  public Array<Integer> getEnemyTimes() {
    return enemyTimes;
  }

  /**
   * @param enemyTimes
   *            the enemyTimes to set
   */
  public void setEnemyTimes(Array<Integer> enemyTimes) {
    this.enemyTimes = enemyTimes;
  }

  protected Vector2 getTopLeft() {
    return new Vector2(0 * Configuration.gameScale, 23 * Configuration.gameScale);
  }

  protected Vector2 getTopRight() {
    return new Vector2(20 * Configuration.gameScale, 23 * Configuration.gameScale);
  }

  protected Vector2 getMidLeft() {
    return new Vector2(0 * Configuration.gameScale, 16 * Configuration.gameScale);
  }

  protected Vector2 getMidRight() {
    return new Vector2(20 * Configuration.gameScale, 16 * Configuration.gameScale);
  }

  protected void setQueues() {
    enemyQueue.clear();
    enemyTimes.clear();

  }

  public void reset() {
    this.setQueues();

  }

}
TOP

Related Classes of com.palepail.TestGame.Levels.Level

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.