var _global = this;

(function () {

// class variables
    var idCounter = 0;
    
// constructor
    
    function Particle (x, y)
    {
        this.id = idCounter++;
        
        this.mass = 1
        
        this.xV = 0;
        this.yV = 0;
        
        this.x  = x;
        this.y  = y;
        
        this._time  = 0;
        this.scale  = 1;
    }
    
    _global.Particle = Particle;
    
// constants

    Particle.G_CONST = 1200;
    
// public

    Particle.prototype.update = function (timeDelta)
    {
        this._time += timeDelta;
        
        this.yV += Particle.G_CONST * this.mass * (timeDelta * timeDelta);
        
        this.x += this.xV;
        this.y += this.yV;
        
        this.xV *= 0.97;
        
        if (this.y > window.innerHeight - 10 && this._time < 2) {
            this.y  = window.innerHeight - 10;
            this.yV = (0 - this.yV) * (Math.random() * 0.2 + 0.2);
        }
    };
    
})();
