package entities;

import com.haxepunk.Entity;
import com.haxepunk.graphics.Image;
import com.haxepunk.masks.Circle;

class Needle extends Entity 
{
	var image: Image;
	var cadranLoop: Int;
	
    public function new(x : Float, y : Float, size, loop : Int)
    {
        super(x, y);
		
		image = Image.createRect(1,size,0x313420);
		graphic = image;
		
		cadranLoop = loop;
		
        type = "needle";
    }
	
	public function setCadran(cadran : Float)
	{
		var cAngle: Float = ((cadran / cadranLoop) * 360) + 180;

		while ( cAngle > 360) { cAngle -= 360; }
		
		cAngle = 360 - cAngle;

		image.angle = cAngle;
		
		update();
	}
}