def move(self, direction): if direction != Action.Wait: dx,dy=Action.nextStep(direction) nx,ny=self.x+dx,self.y+dy if nx<0 or nx>=Level.__LEVEL_SIZE[0] or ny<0 or ny>=Level.__LEVEL_SIZE[1]: error('chip tried to step out side of bounds') return if not self.top_layer[ny][nx].canChipStep(): error('chip tried to step on something he cant') return status = self.top_layer[ny][nx].effect() self.top_layer[ny][nx] = self.top_layer[self.y][self.x] self.top_layer[self.y][self.x] = Empty(self.x, self.y) self.x=nx self.y=ny return status
def getNextStep(self, dir = None): if (dir is None): dir = self.facing x, y = Action.nextStep(dir) return self.X + x, self.Y + y
def getNextStep(self): x, y = Action.nextStep(self.facing) return self.X + x, self.Y + y