function FlowerSystem() { this.flowers = []; //this.dirtHeight = 0; this.addFlower = function(origin) { this.flowers.push(new Flower(origin, millis())); } this.run = function() { for (var i = 0; i < this.flowers.length; i++) { this.flowers[i].update(i); if (millis() - this.flowers[i].age > 150000*(frameRate()/40)) { this.flowers.splice(i, 0) } } } }