Package org.sfsoft.jfighter2dx.managers

Source Code of org.sfsoft.jfighter2dx.managers.PowerupSpawner

package org.sfsoft.jfighter2dx.managers;

import static org.sfsoft.jfighter2dx.util.Constants.SCREEN_HEIGHT;
import static org.sfsoft.jfighter2dx.util.Constants.ITEM_HEIGHT;

import java.util.Random;

import org.sfsoft.jfighter2dx.powerups.Bomb;
import org.sfsoft.jfighter2dx.powerups.Powerup;
import org.sfsoft.jfighter2dx.powerups.Shield;
import org.sfsoft.jfighter2dx.powerups.Powerup.PowerupType;

/**
* Clase que genera los diferentes powerups que aparecen a lo largo de la partida
* @author Santiago Faci
* @version Agosto 2014
*/
public class PowerupSpawner {

  public static Powerup createPowerup(PowerupType type) {
   
    Powerup powerup = null;
   
    switch (type) {
      case BOMB:
        powerup = new Bomb(1000, new Random().nextInt(SCREEN_HEIGHT - ITEM_HEIGHT), -100f);
        break;
      case SHIELD:
        powerup = new Shield(1000, new Random().nextInt(SCREEN_HEIGHT - ITEM_HEIGHT), -100f);
        break;
    }
   
    return powerup;
  }
}
TOP

Related Classes of org.sfsoft.jfighter2dx.managers.PowerupSpawner

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.