so many spaces ugh

This commit is contained in:
John Cote 2015-04-30 20:10:54 -04:00
parent 21e1d98e76
commit 38dfc863af

View file

@ -136,10 +136,8 @@ class GardenDropGame:
def testGridfull(self, cell): def testGridfull(self, cell):
if not cell: if not cell:
return 0 return 0
elif cell[0] != None: elif cell[0] != None:
return 1 return 1
else: else:
return 0 return 0
@ -148,10 +146,8 @@ class GardenDropGame:
def getValidGrid(self, x, z): def getValidGrid(self, x, z):
if x < 0 or x >= GardenGameGlobals.gridDimX: if x < 0 or x >= GardenGameGlobals.gridDimX:
return None return None
elif z < 0 or z >= GardenGameGlobals.gridDimZ: elif z < 0 or z >= GardenGameGlobals.gridDimZ:
return None return None
else: else:
return self.grid[x][z] return self.grid[x][z]
@ -160,13 +156,10 @@ class GardenDropGame:
def getColorType(self, x, z): def getColorType(self, x, z):
if x < 0 or x >= GardenGameGlobals.gridDimX: if x < 0 or x >= GardenGameGlobals.gridDimX:
return -1 return -1
elif z < 0 or z >= GardenGameGlobals.gridDimZ: elif z < 0 or z >= GardenGameGlobals.gridDimZ:
return -1 return -1
elif self.grid[x][z][0] == None: elif self.grid[x][z][0] == None:
return -1 return -1
else: else:
return self.grid[x][z][0].colorType return self.grid[x][z][0].colorType
@ -175,7 +168,6 @@ class GardenDropGame:
def getSprite(self, spriteIndex): def getSprite(self, spriteIndex):
if spriteIndex >= len(self.sprites) or self.sprites[spriteIndex].markedForDeath: if spriteIndex >= len(self.sprites) or self.sprites[spriteIndex].markedForDeath:
return None return None
else: else:
return self.sprites[spriteIndex] return self.sprites[spriteIndex]
@ -258,7 +250,6 @@ class GardenDropGame:
if self.getColorType(cellX + 1, cellZ - 1) == colorType: if self.getColorType(cellX + 1, cellZ - 1) == colorType:
self.fillMatchList(cellX + 1, cellZ - 1) self.fillMatchList(cellX + 1, cellZ - 1)
else: else:
if self.getColorType(cellX - 1, cellZ) == colorType: if self.getColorType(cellX - 1, cellZ) == colorType:
self.fillMatchList(cellX - 1, cellZ) self.fillMatchList(cellX - 1, cellZ)
@ -297,37 +288,26 @@ class GardenDropGame:
if cellZ % 2 == 0: if cellZ % 2 == 0:
if self.testGridfull(self.getValidGrid(cellX - 1, cellZ)): if self.testGridfull(self.getValidGrid(cellX - 1, cellZ)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ)): elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX, cellZ + 1)): elif self.testGridfull(self.getValidGrid(cellX, cellZ + 1)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ + 1)): elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ + 1)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX, cellZ - 1)): elif self.testGridfull(self.getValidGrid(cellX, cellZ - 1)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ - 1)): elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ - 1)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX - 1, cellZ)): elif self.testGridfull(self.getValidGrid(cellX - 1, cellZ)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ)): elif self.testGridfull(self.getValidGrid(cellX + 1, cellZ)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX, cellZ + 1)): elif self.testGridfull(self.getValidGrid(cellX, cellZ + 1)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX - 1, cellZ + 1)): elif self.testGridfull(self.getValidGrid(cellX - 1, cellZ + 1)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX, cellZ - 1)): elif self.testGridfull(self.getValidGrid(cellX, cellZ - 1)):
gotNeighbor = 1 gotNeighbor = 1
elif self.testGridfull(self.getValidGrid(cellX - 1, cellZ - 1)): elif self.testGridfull(self.getValidGrid(cellX - 1, cellZ - 1)):
gotNeighbor = 1 gotNeighbor = 1
@ -353,7 +333,6 @@ class GardenDropGame:
if movingSprite.isQue or testSprite.isQue: if movingSprite.isQue or testSprite.isQue:
if self.testDistance(movingSprite.nodeObj, testSprite.nodeObj) < GardenGameGlobals.queExtent * (movingSprite.size + testSprite.size): if self.testDistance(movingSprite.nodeObj, testSprite.nodeObj) < GardenGameGlobals.queExtent * (movingSprite.size + testSprite.size):
self.push(movingSprite, testSprite) self.push(movingSprite, testSprite)
elif self.testDistance(movingSprite.nodeObj, testSprite.nodeObj) < movingSprite.size + testSprite.size: elif self.testDistance(movingSprite.nodeObj, testSprite.nodeObj) < movingSprite.size + testSprite.size:
if movingSprite.isActive: if movingSprite.isActive:
testSprite.isActive or self.__collide(movingSprite, testSprite) testSprite.isActive or self.__collide(movingSprite, testSprite)
@ -372,12 +351,10 @@ class GardenDropGame:
que = move que = move
hit = test hit = test
queHit = 1 queHit = 1
elif test.isQue: elif test.isQue:
que = test que = test
hit = move hit = move
queHit = 1 queHit = 1
else: else:
test.velX = 0 test.velX = 0
test.velZ = 0 test.velZ = 0
@ -402,7 +379,6 @@ class GardenDropGame:
que = move que = move
hit = test hit = test
queHit = 1 queHit = 1
elif test.isQue: elif test.isQue:
que = test que = test
hit = move hit = move