Пример #1
0
    def __init__(self):
        self.window_width = 800
        self.window_height = 600
        self.window = pygame.display.set_mode(
            (self.window_width, self.window_height))
        self.running = True
        self.top_color = (255, 225, 200)
        self.bottom_color = (50, 0, 50)
        self.clock = pygame.time.Clock()
        self.audio_manager = AudioManager.AudioManager()
        self.part_sys = ParticleSystem.ParticleSystem(self.top_color,
                                                      self.bottom_color)
        self.top_player = Player.Player(self.window_width // 2 - 12, -50,
                                        self.part_sys, self.audio_manager)
        self.bottom_player = Player.Player(self.window_width // 2 - 12,
                                           self.window_height, self.part_sys,
                                           self.audio_manager)
        self.immovable_num = 3
        self.level_num = -1
        self.max_level_num = 5
        self.level = Level.Level()
        self.camera = Camera.Camera(self.window)
        self.game_state = GameState.MENU
        self.credits = Credits.Credits(self.window_width, self.window_height,
                                       self.top_color)
        self.menu = Menu.Menu(self.window_width, self.window_height,
                              self.bottom_color, self.top_color)
        self.next_state = None
        self.transitioning = False
        self.animator = Animator.Animator()

        pygame.display.set_caption("Laws of Reflection")
        self.bottom_player.inverse()
        self.next_level()
Пример #2
0
import pygame

from Credits import *
from Menu import *
from Options import *
from Starmap import *
'''

'''
(screen, world) = init()
launch = True
menu = Menu()
starmap = StarMap()
credits = Credits()
options = Options()
#world = GameWorld(screen)
t1 = 0
t0 = 0
config = ConfigParser.RawConfigParser()
config.read('settings.cfg')
menu.setSound(config.getint('settings', 'volume'))
menu.setMusic(config.getint('settings', 'music'))

starmap_timer = time.clock()
starmap_active = False
pygame.mouse.set_visible(False)
# pygame.transform.set_smoothscale_backend("MMX")
menu.music.play(-1)

while launch:
Пример #3
0
    def runStoryMode(self, peach):
        while not self.__completed:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    self.__completed = True

                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_q:
                        self.__completed = True

            # fills screen blue only in select rectangular area (sky)
            self.__screen.fill((110, 193, 248), rect=(0, 0, 640, 384))
            # fills screen green only in select rectangular area (grass/ground)
            self.__screen.fill((0, 155, 0), rect=(0, 384, 640, 96))

            self.findInput()

            # Causes the sprite's x coordinate to change accordingly
            peach.__x += self.__moveX

            # if sprite hits edge of screen, it will stop there
            if peach.__x <= 0:
                peach.__x = 0
            if peach.__x >= 620:
                peach.__x = 620

            # writes the super princess peach logo
            self.renderLogo()

            self.renderCastleRects()

            startingPointsX = []
            # while peach is before the first castle the sign will show
            for x in range(100):
                startingPointsX.append(x)
            startingPointsY = [355]
            if peach.__x in startingPointsX and peach.__y in startingPointsY:
                self.renderSpeechBubble()
                self.renderBowser()
                self.renderMario()
                self.writeMessage1()
                self.writeMessage2()

            self.renderGround()
            self.renderCastle()

            # associates the sprite with the image in updateSprite()
            peach.updateSprite(peach)

            # self.__FPS stands for frames per second
            self.__clock.tick(self.__FPS)

            pygame.display.update()

        # stops all music from playing
        pygame.mixer.music.stop()

        if self.__state == 2:
            # You won
            playCredits = Credits.Credits()
            playCredits.runCredits()
        else:
            # you lost, game over
            playGameOver = GameOver.GameOver()
            playGameOver.runGameOver()