Esempio n. 1
0
    def __init__(self, display):
        self.font_name = pg.font.match_font(settings.FONT_NAME)
        self.display = display

        self.bg = resourceManager.getImage(settings.main_menu_image, False)
        self.go = resourceManager.getImage(settings.game_over_image, False)
        self.fi = resourceManager.getImage(settings.finish_image, False)

        self.display.blit(self.bg, (0, 0))
        self.selectedPlaylistName = None
        pg.display.flip()

        self.highscores = resourceManager.getHighscores()
Esempio n. 2
0
    def __init__(self, x, y):
        pg.sprite.Sprite.__init__(self)

        self.image = pg.Surface((TILESIZE, TILESIZE))
        self.images = []
        for n in range(1, 9):
            self.images.append(
                rM.getImage("coin_frame" + str(n) + ".png", True))
        self.tc = TextureCycler(self, self.images, 1 / len(self.images))

        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
Esempio n. 3
0
    def __init__(self, game, prop, w, h):
        pg.sprite.Sprite.__init__(self)
        self.game = game
        self.image = pg.Surface((w, h))
        self.image = rM.getImage("idle.gif", True)
        self.rect = self.image.get_rect()
        self.vel = vec(0, 0)
        self.acc = vec(0, 0)
        self.change = vec(0, 0)
        self.collision_streak = 0

        # properties
        self.PLAYER_WIDTH = w
        self.PLAYER_HEIGHT = h
        self.PLAYER_ACC = prop[0]
        self.PLAYER_FRICTION = prop[1]
        self.PLAYER_GRAV = prop[2]
        self.PLAYER_JUMP = prop[3]

        # sounds
        self.jump_pad_sound = rM.getSound("Trampoline2.wav")

        # animations
        self.IDLE_IMAGE_RIGHT = rM.getImage("idle.gif", True)
        self.JUMP_IMAGE_RIGHT = rM.getImage("jump.png", True)
        self.FALL_IMAGE_RIGHT = rM.getImage("mid air.gif", True)

        self.IDLE_IMAGE_LEFT = rM.getImage("idle_inverted.gif", True)
        self.JUMP_IMAGE_LEFT = rM.getImage("jump_inverted.png", True)
        self.FALL_IMAGE_LEFT = rM.getImage("mid air_inverted.gif", True)

        self.last_direction_right = True

        images = []
        for n in range(0, 8):
            images.append(rM.getImage("character_run" + str(n) + ".gif", True))
        self.runanimationright = TextureCycler(self, images, 0.07)

        images = []
        for n in range(0, 8):
            images.append(
                rM.getImage("character_run" + str(n) + "_inverted.gif", True))
        self.runanimationleft = TextureCycler(self, images, 0.07)
Esempio n. 4
0
    def __init__(self, game, x, y, tile_id, speed, style):
        pg.sprite.Sprite.__init__(self)
        self.image = pg.Surface((TILESIZE, TILESIZE))
        self.image = rM.getImage("ghost0.png", True)
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y - 6
        self.game = game
        self.speed = speed
        self.direction = 1  # 1 is forward, -1 is backwards

        images = []
        for n in range(0, 3):
            images.append(rM.getImage("ghost" + str(n) + ".png", True))
        images.append(rM.getImage("ghost1.png", True))
        self.runanimationright = TextureCycler(self, images, 0.5)

        images = []
        for n in range(0, 3):
            images.append(rM.getImage("ghost" + str(n) + "_inverted.png",
                                      True))
        images.append(rM.getImage("ghost1_inverted.png", True))
        self.runanimationleft = TextureCycler(self, images, 0.5)
Esempio n. 5
0
    def __init__(self, game, x, y, tile_id):
        pg.sprite.Sprite.__init__(self)
        self.image = pg.Surface((TILESIZE, TILESIZE))
        self.tid = tile_id

        self.images = []
        for n in range(0, 5):
            self.images.append(rM.getImage("laser" + str(n) + ".png", False))
        self.image = self.images[0]

        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.game = game
        self.on = False
        self.timer = time.time()
        self.beam = Beam(x, y)

        self.state = 0
        self.game.all_sprites.add(self.beam)