def freeFall(obj, ladder_list, block_list): check = checkcollision.checkCollision(obj, ladder_list, obj.rect.x, obj.rect.y, 0, 0) if check == 0: check = checkwall.checkWall(obj, obj.rect.x, obj.rect.y, 0, 10, block_list) while check == 0: obj.rect.y += 10 check = checkwall.checkWall(obj, obj.rect.x, obj.rect.y, 0, 10, block_list)
def moveRandom(self): import random a = random.randint(1,2) if a==2 : check = checkwall.checkWall(self.donkey , self.donkey.rect.x , self.donkey.rect.y , 20, 10, block_list) if check != 0 : self.donkey.rect.x += 20 else : check = checkwall.checkWall (self.donkey, self.donkey.rect.x, self.donkey.rect.y , -20 , 0 , block_list) if check== 0 : self.donkey.rect.x -= 20
def moveRandom(self): import random a = random.randint(1, 2) if a == 2: check = checkwall.checkWall(self.donkey, self.donkey.rect.x, self.donkey.rect.y, 20, 10, block_list) if check != 0: self.donkey.rect.x += 20 else: check = checkwall.checkWall(self.donkey, self.donkey.rect.x, self.donkey.rect.y, -20, 0, block_list) if check == 0: self.donkey.rect.x -= 20
def moveLeft(self): __check = checkwall.checkWall(self.player, self.player.rect.x, self.player.rect.y, -10, 0, block_list) if __check == 0: self.player.rect.x -= 10 freefall.freeFall(self.player, ladder_list, block_list)
def moveLeft(self): __check = checkwall.checkWall(self.player , self.player.rect.x , self.player.rect.y , -10 , 0, block_list) if __check == 0 : self.player.rect.x -= 10 freefall.freeFall(self.player,ladder_list, block_list)
def move(self, ladder_list, block_list, fire_sprite, screen): for i in range(self.countstart, self.countend): if self.fire[i].rect.x == 10 and self.fire[i].rect.y == 480: fire_sprite.remove(self.fire[i]) freefall.freeFall(self.fire[i], ladder_list, block_list) fire_sprite.draw(screen) if self.fire_p[i] == 0: check = checkwall.checkWall(self.fire[i], self.fire[i].rect.x, self.fire[i].rect.y, 10, 0, block_list) if check == 0: check = checkcollision.checkCollision( self.fire[i], ladder_list, self.fire[i].rect.x, self.fire[i].rect.y, 0, 10) if check == 0: self.fire[i].rect.x += 10 fire_sprite.draw(screen) else: a = random.randint(1, 3) if a == 1: self.fire[i].rect.x += 10 self.fire_p[i] = 1 else: self.fire[i].rect.y += 10 self.fire_p[i] = 2 else: self.fire[i].rect.x -= 10 self.fire_p[i] = 3 elif self.fire_p[i] == 1: check = checkwall.checkWall(self.fire[i], self.fire[i].rect.x, self.fire[i].rect.y, 10, 0, block_list) if check == 0: check = checkwall.checkWall(self.fire[i], self.fire[i].rect.x, self.fire[i].rect.y, 10, 10, block_list) if check != 0: self.fire[i].rect.x += 10 else: self.fire[i].rect.x += 10 self.fire_p[i] = 4 else: self.fire_p[i] = 3 elif self.fire_p[i] == 2: check = checkcollision.checkCollision(self.fire[i], ladder_list, self.fire[i].rect.x, self.fire[i].rect.y, 0, 10) if check != 0: self.fire[i].rect.y += 10 else: a = random.randint(1, 3) if a == 1: self.fire_p[i] = 0 else: self.fire_p[i] = 1 elif self.fire_p[i] == 4: freefall.freeFall(self.fire[i], ladder_list, block_list) a = random.randint(1, 3) if a == 1: self.fire_p[i] = 0 else: self.fire_p[i] = 3 if self.fire_p[i] == 3: check = checkwall.checkWall(self.fire[i], self.fire[i].rect.x, self.fire[i].rect.y, -10, 0, block_list) if check == 0: check = checkcollision.checkCollision( self.fire[i], ladder_list, self.fire[i].rect.x, self.fire[i].rect.y, 0, 10) if check == 0: self.fire[i].rect.x -= 10 fire_sprite.draw(screen) else: a = random.randint(1, 3) if a == 1: self.fire[i].rect.x -= 10 self.fire_p[i] = 5 else: self.fire[i].rect.y += 10 self.fire_p[i] = 2 else: self.fire_p[i] = 0 if self.fire_p[i] == 5: check = checkwall.checkWall(self.fire[i], self.fire[i].rect.x, self.fire[i].rect.y, -10, 0, block_list) if check == 0: check = checkwall.checkWall(self.fire[i], self.fire[i].rect.x, self.fire[i].rect.y, 10, 10, block_list) if check != 0: self.fire[i].rect.x -= 10 else: self.fire[i].rect.x -= 10 self.fire_p[i] = 4 else: self.fire_p[i] = 0