Beispiel #1
0
class User_Interface:
    """User interface provides both the view of the game
    and the means to interact with it."""
    def __init__(self, net, (width, height), bg_number):
        """The user interface will be recreated whenever the
        window is resized. It is not part of a saved game."""
        self.net = net

        self.Reset()
        self.blink = 0xff

        self.screen_rect = Rect(0, 0, width, height)

        img = resource.Load_Image("back.jpg").convert()
        # (convert destroys a-channel)
        # Although there is only one base image, it is flipped and
        # rotated on startup to create one of eight possible backdrops.

        img = pygame.transform.rotate(img, 90 * (bg_number & 3))
        if bg_number & 4:
            img = pygame.transform.flip(img, True, False)

        self.background = pygame.transform.scale(img, (width, height))

        self.steam_effect = particle.Make_Particle_Effect(
            particle.Steam_Particle)
        self.steam_effect_frame = 0
Beispiel #2
0
def Init_Storms():
    # This is rather slow.
    global storm_graphics
    storm_graphics = particle.Make_Particle_Effect(particle.Storm_Particle)

    global storm_sound
    storm_sound = sound.Persisting_Sound("stormdmg", "stormbeeps")
Beispiel #3
0
    def __init__(self, net, xxx_todo_changeme):
        (width, height) = xxx_todo_changeme
        self.net = net
        self.control_menu = None

        self.Reset()
        self.blink = 0xff

        img = resource.Load_Image(
            "back.jpg").convert()  # convert destroys a-channel

        # Although there is only one base image, it is flipped and
        # rotated on startup to create one of eight possible backdrops.
        # (Note: These don't get saved, as they're part of the UI. That's bad.)

        img = pygame.transform.rotate(img, 90 * random.randint(0, 3))
        if (random.randint(0, 1) == 0):
            img = pygame.transform.flip(img, True, False)

        self.background = pygame.transform.scale(img, (width, height))

        self.steam_effect = particle.Make_Particle_Effect(
            particle.Steam_Particle)
        self.steam_effect_frame = 0