Update flipflop.js
This commit is contained in:
parent
53b47488de
commit
a8999ba4dc
|
|
@ -1,5 +1,7 @@
|
|||
elements.flipflop = {
|
||||
powerstate: "false",
|
||||
properties: {
|
||||
powerstate: "false",
|
||||
},
|
||||
name: "Flip Flop",
|
||||
color: "#CF300D",
|
||||
state: "solid",
|
||||
|
|
@ -12,14 +14,17 @@ elements.flipflop = {
|
|||
|
||||
let Output = pixelMap[pixel.x+1][pixel.y]
|
||||
let Input = pixelMap[pixel.x-1][pixel.y]
|
||||
console.log(pixel.powerstate)
|
||||
if (typeof Output !== "undefined" && typeof Input !== "undefined"){
|
||||
Output.charge = 0
|
||||
if (pixel.powerstate == "true" && pixel.charge > 0.2) {
|
||||
pixel.powerstate = "false"
|
||||
pixel.color = "#CF300D"
|
||||
console.log(pixel.powerstate+"y")
|
||||
Output.charge = 0
|
||||
} else if (pixel.powerstate == "false" && pixel.charge > 0.2) {
|
||||
pixel.powerstate = "true"
|
||||
console.log(pixel.powerstate+"n")
|
||||
pixel.color = "#94CF0D"
|
||||
Output.charge = 5
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue