pushing machines

each of which pushes pixels in a certain direction
This commit is contained in:
Lily-129 2022-03-04 11:40:07 -05:00 committed by GitHub
parent 9f560c96f5
commit cedc5c7c43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 55 additions and 0 deletions

55
mods/pushers.js Normal file
View File

@ -0,0 +1,55 @@
elements.up_pusher = {
color: "#7f7f7f",
tick: function(pixel) {
for(i=9; i>=0; i--) {
if (!isEmpty(pixel.x,pixel.y-1-i,true)) {
tryMove(pixelMap[pixel.x][pixel.y-1-i],pixel.x,pixel.y-2-i)
}
}
},
category: "machines",
insulate: true,
state: "solid",
}
elements.down_pusher = {
color: "#7f7f7f",
tick: function(pixel) {
for(i=9; i>=0; i--) {
if (!isEmpty(pixel.x,pixel.y+1+i,true)) {
tryMove(pixelMap[pixel.x][pixel.y+1+i],pixel.x,pixel.y+2+i)
}
}
},
category: "machines",
insulate: true,
state: "solid",
}
elements.left_pusher = {
color: "#7f7f7f",
tick: function(pixel) {
for(i=9; i>=0; i--) {
if (!isEmpty(pixel.x-1-i,pixel.y,true)) {
tryMove(pixelMap[pixel.x-1-i][pixel.y],pixel.x-2-i,pixel.y)
}
}
},
category: "machines",
insulate: true,
state: "solid",
}
elements.right_pusher = {
color: "#7f7f7f",
tick: function(pixel) {
for(i=9; i>=0; i--) {
if (!isEmpty(pixel.x+1+i,pixel.y,true)) {
tryMove(pixelMap[pixel.x+1+i][pixel.y],pixel.x+2+i,pixel.y)
}
}
},
category: "machines",
insulate: true,
state: "solid",
}