Update flipflop.js
This commit is contained in:
parent
92b23492d7
commit
ebffb3b65d
|
|
@ -10,18 +10,16 @@ elements.flipflop = {
|
||||||
doBurning(pixel)
|
doBurning(pixel)
|
||||||
doElectricity(pixel)
|
doElectricity(pixel)
|
||||||
|
|
||||||
let Powerstate = pixel.powerstate
|
|
||||||
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]
|
||||||
console.log(typeof Output)
|
|
||||||
if (typeof Output !== "undefined" && typeof Input !== "undefined"){
|
if (typeof Output !== "undefined" && typeof Input !== "undefined"){
|
||||||
Output.charge = 0
|
Output.charge = 0
|
||||||
if (Powerstate == "true" && Input.charge > 0.2) {
|
if (pixel.powerstate == "true" && Input.charge > 0.2) {
|
||||||
Powerstate = "false"
|
pixel.powerstate = "false"
|
||||||
pixel.color = "#CF300D"
|
pixel.color = "#CF300D"
|
||||||
Output.charge = 0
|
Output.charge = 0
|
||||||
} else if (Powerstate == false && Input.charge > 0.2) {
|
} else if (pixel.powerstate == "false" && Input.charge > 0.2) {
|
||||||
Powerstate = true
|
pixel.powerstate = "true"
|
||||||
pixel.color = "#94CF0D"
|
pixel.color = "#94CF0D"
|
||||||
Output.charge = 5
|
Output.charge = 5
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue