package ludumdare.game;

import java.awt.event.KeyEvent;

import org.crusty.math.Vec2double;

public class Rocket extends Entity {

	//Entity[] sprites = new Entity[4];
	
	public Rocket() {
		super(SpriteManager.getSprite("rocket.png"));
		
		this.pos.x = 200;
		this.pos.y = 280;
	}
	
	public void logic(double dt) {
		
		if (Game.keys[KeyEvent.VK_SPACE]) { 
			this.acc.y = -0.1;
//			if (this.acc.y > -0.1) {
//				this.acc.y -= 0.01;
//			System.out.println("a");
//			}
			Vec2double firePos = new Vec2double(pos.x + 40, pos.y + 190);
			Vec2double smokePos = firePos.clone();
			smokePos.x -= 10;
			ParticleManager.addParticle(3, SpriteManager.getSprite("fire.png"), firePos, "rocketFire");
			ParticleManager.addParticle(1, SpriteManager.getSprite("smoke.png"), smokePos, "rocketSmoke");
		}
		
		super.logic(dt);
	}
	
//	public void draw(Graphics2D g) {
//		g.drawImage(sprite.image, 
//					(int) pos.x, 
//					(int) pos.y, 
//					null);
//	}
	
}
