Added population chart to statistics panel

This commit is contained in:
Max Robinson
2021-02-08 17:19:10 -07:00
parent 7087c5b4ae
commit 382794bf3f
10 changed files with 614 additions and 26 deletions

View File

@@ -10,8 +10,7 @@ class EnvironmentController extends CanvasController{
super(env, canvas);
this.mode = Modes.Drag;
this.org_to_clone = null;
this.species_to_clone = null;
this.make_new_species = false;
this.add_new_species = false;
this.defineZoomControls();
this.scale = 1;
}
@@ -121,16 +120,19 @@ class EnvironmentController extends CanvasController{
case Modes.Clone:
if (this.org_to_clone != null){
var new_org = new Organism(this.mouse_c, this.mouse_r, this.env, this.org_to_clone);
if (this.make_new_species){
this.species_to_clone = FossilRecord.addSpecies(new_org, null)
this.make_new_species = false;
if (this.add_new_species){
FossilRecord.addSpeciesObj(new_org.species);
new_org.species.start_tick = this.env.total_ticks;
this.add_new_species = false;
new_org.species.population = 0;
}
else {
new_org.species = this.species_to_clone;
this.species_to_clone.addPop();
else if (this.org_to_clone.species.extinct){
FossilRecord.resurrect(this.org_to_clone.species);
}
if (new_org.isClear(this.mouse_c, this.mouse_r)){
this.env.addOrganism(new_org)
this.env.addOrganism(new_org);
new_org.species.addPop();
}
}
break;