color bugfix

This commit is contained in:
Nekonico 2024-10-08 11:37:16 -07:00 committed by GitHub
parent 5b9f261022
commit a2195e66bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -4,22 +4,24 @@ elements.organism = {
color: ["#997457","#c4b270","#9c916a","#9e8955","#a89a76"],
properties: {
geneticCode: 0,
oldvore: 0,
vore: 0,
food: 0,
age: 0
},
tick: function(pixel) {
if (pixel.vore != pixel.oldvore) {
if (pixel.vore === 0) {
if (Math.random() > 0.2) {
if (Math.random() > 0.5) {
pixel.color = "#997457"
}
else if (Math.random() > 0.2) {
else if (Math.random() > 0.5) {
pixel.color = "#c4b270"
}
else if (Math.random() > 0.2) {
else if (Math.random() > 0.5) {
pixel.color = "#9c916a"
}
else if (Math.random() > 0.2) {
else if (Math.random() > 0.5) {
pixel.color = "#9e8955"
}
else {
@ -80,6 +82,8 @@ elements.organism = {
else if (pixel.vore < -8) {
pixel.color = "#1CBC10"
}
pixel.oldvore = pixel.vore
}
if (pixel.geneticCode < 11) {
if (isEmpty(pixel.x, pixel.y+1)) {
movePixel(pixelMap[pixel.x][pixel.y], pixel.x, pixel.y+1);