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 levelcomplete(self): check = checkcollision.checkCollision(self.player, queen_sprite, self.player.rect.x, self.player.rect.y, 0, 0) if check > 0: return 1 else: return 0
def gameover(self): __check = checkcollision.checkCollision(self.player, donkey_sprite, self.player.rect.x, self.player.rect.y, 0, 0) if __check > 0: return 1 else: return 0
def moveUp(self): __check = checkcollision.checkCollision(self.player, ladder_list, self.player.rect.x, self.player.rect.y, 0, 0) if __check > 0: self.player.rect.y -= 10 boardObj.printLayout(block_list, ladder_list, fire_sprite, donkey_sprite, queen_sprite, coin_sprite, player_sprite, screen)
def levelcomplete(self): check = checkcollision.checkCollision(self.player ,queen_sprite, self.player.rect.x , self.player.rect.y , 0 , 0) if check > 0 : return 1 else: return 0
def gameover(self): __check = checkcollision.checkCollision(self.player ,donkey_sprite, self.player.rect.x , self.player.rect.y , 0 , 0) if __check > 0 : return 1 else: return 0
def moveUp(self): __check = checkcollision.checkCollision(self.player ,ladder_list, self.player.rect.x , self.player.rect.y , 0 , 0) if __check > 0 : self.player.rect.y -= 10 boardObj.printLayout(block_list,ladder_list,fire_sprite,donkey_sprite,queen_sprite,coin_sprite,player_sprite,screen)
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