/*
 * Meteor.java
 *
 * Created on 10 janvier 2005, 00:04
 */

package hyperion;
import java.applet.*;
import java.awt.*;
import java.net.*;
/**
 *
 * @author CryoGen
 */
public class Meteor extends Entity{
    static public Image imgT11;
    static public Image imgT12;
    static public Image imgT13;
    static public Image imgT21;
    static public Image imgT22;
    static public Image imgT23;
    static public Image imgT31;
    static public Image imgT32;
    static public Image imgT33;
    
    private Animation anime;
        
    public static final int TYPE_1 = 1;
    public static final int TYPE_2 = 2;
    public static final int TYPE_3 = 3;
    public static final int TAILLE_1 = 1;
    public static final int TAILLE_2 = 2;
    public static final int TAILLE_3 = 3;
    
    //private int taille_anim;
    //private int _x, _y;
    
    private int vie, vie_t;
    
    /** Creates a new instance of Meteor */
    public Meteor(int type, int taille, int x, int y, Applet applet) {
        this._x = x;
        this._y = y;
        this.height = 32 * taille;
        this.width = 32 *taille;
        
        this.type = type;
        this.stype = taille;
        
        switch(type)
        {
            case TYPE_1:
                switch(taille)
                {
                    case TAILLE_1:
                        anime = new Animation(imgT11, 32, 256, 64, applet);
                        anime.setSpeed(0.5f);
                        this.vie = 5;
                        break;
                    case TAILLE_2:
                        anime = new Animation(imgT12, 64, 512, 192, applet);
                        anime.setSpeed(0.3f);
                        this.vie = 10;
                        break;
                    case TAILLE_3:
                        anime = new Animation(imgT13, 96, 480, 480, applet);
                        anime.setSpeed(0.3f);
                        this.vie = 20;
                        break;
                    default:break;
                }
                break;
                
                case TYPE_2:
                switch(taille)
                {
                    case TAILLE_1:
                        anime = new Animation(imgT21, 32, 256, 64, applet);
                        anime.setSpeed(0.5f);
                        this.vie = 5;
                        break;
                    case TAILLE_2:
                        anime = new Animation(imgT22, 64, 512, 192, applet);
                        anime.setSpeed(0.3f);
                        this.vie = 10;
                        break;
                    case TAILLE_3:
                        anime = new Animation(imgT23, 96, 480, 480, applet);
                        anime.setSpeed(0.3f);
                        this.vie = 20;
                        break;
                    default:break;
                }
                break;
                
                case TYPE_3:
                switch(taille)
                {
                    case TAILLE_1:
                        anime = new Animation(imgT31, 32, 256, 64, applet);
                        anime.setSpeed(0.5f);
                        this.vie = 5;
                        break;
                    case TAILLE_2:
                        anime = new Animation(imgT32, 64, 512, 192, applet);
                        anime.setSpeed(0.3f);
                        this.vie = 10;
                        break;
                    case TAILLE_3:
                        anime = new Animation(imgT33, 96, 480, 480, applet);
                        anime.setSpeed(0.3f);
                        this.vie = 20;
                        break;
                    default:break;
                }
                break;
        }
        this.vie_t = vie;
    }
    
    public boolean modVie(int inc)
    {
        this.vie += inc;
        if(this.vie <= 0) return true;
        else return false;
    }
    
    public int getVie() { return vie_t; };
    
    public void draw(Graphics g)
    {
        anime.draw(g, _x, _y);
    }
    
}

















