Update flipflop.js
This commit is contained in:
parent
e168be81c8
commit
c8ea492073
|
|
@ -13,17 +13,20 @@ elements.flipflop = {
|
||||||
|
|
||||||
let Output = pixelMap[pixel.x+1][pixel.y]
|
let Output = pixelMap[pixel.x+1][pixel.y]
|
||||||
let Input = pixelMap[pixel.x-1][pixel.y]
|
let Input = pixelMap[pixel.x-1][pixel.y]
|
||||||
if (typeof Output !== "undefined" && typeof Input !== "undefined")
|
if (typeof Output !== "undefined" && typeof Input !== "undefined") {
|
||||||
if (pixel.powerstate == "true" && Input.charge > 0.2) {
|
if (Input.charge > 0.4) {
|
||||||
Input.charge = 0
|
if (pixel.powerstate == "true") {
|
||||||
pixel.powerstate = "false"
|
Input.charge = 0
|
||||||
pixel.color = "#CF300D"
|
pixel.powerstate = "false"
|
||||||
Output.charge = 0
|
pixel.color = "#CF300D"
|
||||||
} else if (pixel.powerstate == "false" && Input.charge > 0.2) {
|
Output.charge = 0
|
||||||
Input.charge = 0
|
} else {
|
||||||
pixel.powerstate = "true"
|
Input.charge = 0
|
||||||
pixel.color = "#94CF0D"
|
pixel.powerstate = "true"
|
||||||
Output.charge = 5
|
pixel.color = "#94CF0D"
|
||||||
|
Output.charge = 5
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue