color bugfix
This commit is contained in:
parent
5b9f261022
commit
a2195e66bf
|
|
@ -4,22 +4,24 @@ elements.organism = {
|
||||||
color: ["#997457","#c4b270","#9c916a","#9e8955","#a89a76"],
|
color: ["#997457","#c4b270","#9c916a","#9e8955","#a89a76"],
|
||||||
properties: {
|
properties: {
|
||||||
geneticCode: 0,
|
geneticCode: 0,
|
||||||
|
oldvore: 0,
|
||||||
vore: 0,
|
vore: 0,
|
||||||
food: 0,
|
food: 0,
|
||||||
age: 0
|
age: 0
|
||||||
},
|
},
|
||||||
tick: function(pixel) {
|
tick: function(pixel) {
|
||||||
|
if (pixel.vore != pixel.oldvore) {
|
||||||
if (pixel.vore === 0) {
|
if (pixel.vore === 0) {
|
||||||
if (Math.random() > 0.2) {
|
if (Math.random() > 0.5) {
|
||||||
pixel.color = "#997457"
|
pixel.color = "#997457"
|
||||||
}
|
}
|
||||||
else if (Math.random() > 0.2) {
|
else if (Math.random() > 0.5) {
|
||||||
pixel.color = "#c4b270"
|
pixel.color = "#c4b270"
|
||||||
}
|
}
|
||||||
else if (Math.random() > 0.2) {
|
else if (Math.random() > 0.5) {
|
||||||
pixel.color = "#9c916a"
|
pixel.color = "#9c916a"
|
||||||
}
|
}
|
||||||
else if (Math.random() > 0.2) {
|
else if (Math.random() > 0.5) {
|
||||||
pixel.color = "#9e8955"
|
pixel.color = "#9e8955"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -80,6 +82,8 @@ elements.organism = {
|
||||||
else if (pixel.vore < -8) {
|
else if (pixel.vore < -8) {
|
||||||
pixel.color = "#1CBC10"
|
pixel.color = "#1CBC10"
|
||||||
}
|
}
|
||||||
|
pixel.oldvore = pixel.vore
|
||||||
|
}
|
||||||
if (pixel.geneticCode < 11) {
|
if (pixel.geneticCode < 11) {
|
||||||
if (isEmpty(pixel.x, pixel.y+1)) {
|
if (isEmpty(pixel.x, pixel.y+1)) {
|
||||||
movePixel(pixelMap[pixel.x][pixel.y], pixel.x, pixel.y+1);
|
movePixel(pixelMap[pixel.x][pixel.y], pixel.x, pixel.y+1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue