flipped signs in destination tryMove's
to make infinite portal loops possible
This commit is contained in:
parent
3a835e27b4
commit
753c264d3f
|
|
@ -33,22 +33,22 @@ elements.portal_in = {
|
|||
randomDestination = pixel.portalArray[Math.floor((Math.random() * pixel.portalArray.length))]
|
||||
if(!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) {
|
||||
if(pixelMap[pixel.x-1][pixel.y].element != pixel.element) {
|
||||
tryMove(pixelMap[pixel.x-1][pixel.y],(randomDestination[0] - 1),(randomDestination[1]))
|
||||
tryMove(pixelMap[pixel.x+1][pixel.y],(randomDestination[0] + 1),(randomDestination[1]))
|
||||
}
|
||||
}
|
||||
if(!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) {
|
||||
if(pixelMap[pixel.x+1][pixel.y].element != pixel.element) {
|
||||
tryMove(pixelMap[pixel.x+1][pixel.y],(randomDestination[0] + 1),(randomDestination[1]))
|
||||
tryMove(pixelMap[pixel.x+1][pixel.y],(randomDestination[0] - 1),(randomDestination[1]))
|
||||
}
|
||||
}
|
||||
if(!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) {
|
||||
if(pixelMap[pixel.x][pixel.y-1].element != pixel.element) {
|
||||
tryMove(pixelMap[pixel.x][pixel.y-1],(randomDestination[0]),(randomDestination[1] - 1))
|
||||
tryMove(pixelMap[pixel.x][pixel.y-1],(randomDestination[0]),(randomDestination[1] + 1))
|
||||
}
|
||||
}
|
||||
if(!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) {
|
||||
if(pixelMap[pixel.x][pixel.y+1].element != pixel.element) {
|
||||
tryMove(pixelMap[pixel.x][pixel.y+1],(randomDestination[0]),(randomDestination[1] + 1))
|
||||
tryMove(pixelMap[pixel.x][pixel.y+1],(randomDestination[0]),(randomDestination[1] - 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue