package zero1hd.rhythmbullet.entity.ally;

import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;

import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.entity.Entity;

public class Laser extends Entity {
	Sound sfx;
	
	@Override
	public void preInit() {
		sprite = new Sprite(assets.get("laser.png", Texture.class));
		sfx = assets.get("laser.ogg", Sound.class);
		setSize(0.25f, 2f);
		super.preInit();
	}
	
	public void init(float x, float y, float rate) {
		setPosition(x-getWidth()/2f, y-getHeight()/2f);
		speed = rate;
		sfx.play(prefs.getFloat("fx vol")/100f);
		angle = 90f;
	}
	
	@Override
	public void calculate(float delta) {
		if (getY() > RhythmBullet.WORLD_HEIGHT) {
			dead = true;
		}
		super.calculate(delta);
	}
	
	@Override
	public void draw(Batch batch) {
		super.draw(batch);
	}
	
	@Override
	public void reset() {
		super.reset();
	}

	@Override
	public void collided(Entity entity) {
		dead = true;
	}

}
