class Crystal
{
    static SIZE = 22;

    constructor( engine , map , x , y )
    {
        this.engine = engine;
        this.map = map;
        this.x = x;
        this.y = y;
        this.quad = new Sparrow.Quad( this.engine , this.x-Crystal.SIZE/2 , this.y-Crystal.SIZE/2 , Crystal.SIZE , Crystal.SIZE , { texture: this.map.crystalTexture } );
    }

    delete()
    {
        this.quad.delete();
    }

    isNear( x , y )
    {
        if ( (x-this.x)*(x-this.x)+(y-this.y)*(y-this.y) < this.map.car.stats.range*this.map.car.stats.range ) return true;
        else return false;
    }

    draw()
    {
        this.quad.draw();
    }
}