Update flipflop.js
This commit is contained in:
parent
a9fb0f1918
commit
ba4cc95089
|
|
@ -15,23 +15,23 @@ 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]
|
||||||
console.log(pixel.powerstate)
|
|
||||||
if (typeof Output !== "undefined" && typeof Input !== "undefined"){
|
if (typeof Output !== "undefined" && typeof Input !== "undefined"){
|
||||||
if (pixel.cooldown > 0){
|
if (pixel.cooldown > 0){
|
||||||
Input.charge=0
|
Input.charge = 0
|
||||||
pixel.cooldown--
|
pixel.cooldown--
|
||||||
|
console.log(pixel.cooldown)
|
||||||
}
|
}
|
||||||
Output.charge = 0
|
Output.charge = 0
|
||||||
if (pixel.powerstate == "true" && Input.charge > 0.2) {
|
if (pixel.powerstate == "true" && Input.charge > 0.2) {
|
||||||
Input.charge = 0
|
Input.charge = 0
|
||||||
|
pixel.cooldown = 3
|
||||||
pixel.powerstate = "false"
|
pixel.powerstate = "false"
|
||||||
pixel.color = "#CF300D"
|
pixel.color = "#CF300D"
|
||||||
console.log(pixel.powerstate+"y")
|
|
||||||
Output.charge = 0
|
Output.charge = 0
|
||||||
} else if (pixel.powerstate == "false" && Input.charge > 0.2) {
|
} else if (pixel.powerstate == "false" && Input.charge > 0.2) {
|
||||||
Input.chare = 0
|
Input.chare = 0
|
||||||
|
pixel.cooldown = 3
|
||||||
pixel.powerstate = "true"
|
pixel.powerstate = "true"
|
||||||
console.log(pixel.powerstate+"n")
|
|
||||||
pixel.color = "#94CF0D"
|
pixel.color = "#94CF0D"
|
||||||
Output.charge = 5
|
Output.charge = 5
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue