Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
            pygame.display.update()
            jumping = 0

            if keydown[pygame.K_d]:
                playerObj.moveRight()

            if keydown[pygame.K_a]:
                playerObj.moveLeft()

            if keydown[pygame.K_w]:
                playerObj.moveUp()

            if keydown[pygame.K_s]:
                playerObj.moveDown()

            freefall.freeFall(player, ladder_list, block_list)

        if playerObj.playerScore() == 1:
            score += 5

        if playerObj.playerHitFire() == 1:
            player_life -= 1
            score -= 25
            if score < 0:
                score = 0

        if playerObj.levelcomplete() == 1:
            gamelevel += 1
            gamestart = 0
            player_life = 3
Ejemplo n.º 3
0
			pygame.display.update()	
			jumping=0 
			
			if keydown[pygame.K_d]:
				playerObj.moveRight()	
						
			if keydown[pygame.K_a]:
				playerObj.moveLeft()	
						
			if keydown[pygame.K_w]:
				playerObj.moveUp()	
						
			if keydown[pygame.K_s]:
				playerObj.moveDown()
			
			freefall.freeFall(player,ladder_list, block_list)
			
		if playerObj.playerScore() == 1:
			score += 5
			
		if playerObj.playerHitFire() == 1:
			player_life -=1
			score -= 25
			if score<0:
				score =0
			
		if playerObj.levelcomplete() == 1: 
			gamelevel += 1
			gamestart = 0
			player_life = 3
			
Ejemplo n.º 4
0
	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)
Ejemplo n.º 5
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