Пример #1
0
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)
Пример #2
0
 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
Пример #3
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
Пример #4
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)
Пример #5
0
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)
Пример #6
0
	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
Пример #7
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
Пример #8
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)
Пример #9
0
    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