Ejemplo n.º 1
0
    def __init__(self):
        """
		Starts in a random position with a random direction, but fixed speed.
		"""
        self.pos = self.random_pos()  #random position on screen
        self.speed = self.random_spd()  #random speed
        self.sprite = theme.sprite('default/ball.png', 0.225)
Ejemplo n.º 2
0
    def __init__(self):
        """
		Starts with speed zero on the upper left corner
		"""
        self.pos = tools.Vector2(constants.DEF_Px, constants.DEF_Py)
        self.direction = constants.STOP
        self.sprite = theme.sprite('default/hero.png', 0.4)
Ejemplo n.º 3
0
    def blit(self, screen):
        """
		blits the title to the screen with its background image
		:param screen: game screen, comes from pygame
		"""

        actualImage = theme.sprite(self.path, 0.85)
        screen.blit(actualImage.img, [self.x, self.y])
Ejemplo n.º 4
0
    def __init__(self, x, y, callAction, imageName):
        """
		:param x: horizontal position of the button
		:param y: vertical position of the button
		:param callAction: function that will be called when the mouse pass over it
		:param imageName: name of the sprite of the button
		"""
        Button.__init__(self, x, y, '', constants.UNCLICKABLE,
                        [constants.NOKEY], callAction,
                        constants.BUTTON_FONT_SIZE, True, None, None)
        self.present_button = theme.sprite(imageName)
        self.width = 197
        self.height = 53
Ejemplo n.º 5
0
def changeTheme(n):
    """
    changes the current theme by updating variables in theme.py
    :param n: index of the new theme
    """
    if n != constants.RESET_THEME:
        changeTheme(constants.RESET_THEME)

    data.i['theme'] = n
    if n == constants.BASIC_THEME:
        #Basic Theme
        theme.backgroundColor = (245, 245, 255)

        #button
        theme.offButtonSprite = theme.sprite('Basic/grey_off_button.png')
        theme.offButtonSpriteMini = theme.sprite(
            'Basic/small_grey_off_button.png')
        theme.offButtonTextColor = constants.DARK_GREEN
        theme.onButtonSprite = theme.sprite('Basic/black_on_button.png')
        theme.onButtonSpriteMini = theme.sprite(
            'Basic/small_black_on_button.png')
        theme.onButtonTextColor = constants.MED_GREEN
        theme.onButtonActualStage = constants.BLUE
        theme.offButtonActualStage = (120, 120, 255)

        #label
        theme.labelBackColor = theme.backgroundColor
        theme.labelTextColor = constants.BLACK
        theme.labelTextLowColor = constants.GRAY
        theme.labelTextLLColor = (180, 180, 180)
        theme.titleBackColor = (205, 255, 205)

        #slider Bar
        theme.sliderPointerSpriteOff = theme.sprite(
            'Basic/small_grey_off_button.png')
        theme.sliderPointerSpriteOn = theme.sprite(
            'Basic/small_black_on_button.png')

        # engine
        theme.conqColor = constants.GREEN
        theme.procColor = constants.LIGHT_GREEN
        theme.freeColor = constants.WHITE
        theme.ballColor = constants.BLUE

        #icons
        theme.sound_on = theme.sprite('sound_on.png')
        theme.sound_off = theme.sprite('sound_off.png')

    elif n == constants.DARK_THEME:
        theme.backgroundColor = (5, 5, 5)

        # button
        theme.offButtonColor = (10, 10, 10)  #DARK_GRAY
        theme.offButtonTextColor = (200, 200, 200)  #LIGHT_GRAY
        theme.onButtonColor = constants.DARK_GREEN
        theme.onButtonTextColor = constants.WHITE
        theme.onButtonActualStage = (120, 120, 250)
        theme.offButtonActualStage = (50, 50, 150)

        # engine
        theme.conqColor = constants.DARK_GREEN
        theme.procColor = constants.GREEN
        theme.freeColor = constants.BLACK
        theme.ballColor = (90, 30, 0)
        theme.titleBackColor = (7, 35, 7)

        # label
        theme.labelBackColor = constants.WHITE  #theme.backgroundColor
        theme.labelTextColor = (180, 180, 180)  #GRAY
        theme.labelTextLowColor = (80, 80, 80)
        theme.labelTextLLColor = (30, 30, 30)

        #slider Bar
        theme.sliderBackColor = (180, 180, 180)
        theme.sliderPointerColorOn = (80, 80, 80)
        theme.sliderPointerColorOff = (150, 150, 150)

        #icons
        theme.sound_on = theme.sprite('Dark/sound_on.png')
        theme.sound_off = theme.sprite('Dark/sound_off.png')

    elif n == constants.MARIO_THEME:
        theme.backgroundColor = (255, 255, 255)

        #button
        theme.offButtonSprite = theme.sprite('SMB/off_button.png')
        theme.offButtonSpriteMini = theme.sprite('SMB/mini_off_button.png')
        theme.offButtonColor = None
        theme.offButtonTextColor = constants.BLACK
        theme.offButtonActualStage = constants.MED_BLUE

        theme.onButtonSprite = theme.sprite('SMB/on_button.png')
        theme.onButtonSpriteMini = theme.sprite('SMB/mini_on_button.png')
        theme.onButtonColor = None
        theme.onButtonTextColor = constants.WHITE
        theme.onButtonActualStage = constants.WHITE

        #label
        theme.labelTextColor = constants.BLACK
        theme.labelTextLowColor = constants.GRAY
        theme.labelTextLLColor = (220, 220, 220)  #Super low
        theme.titleBackColor = (240, 240, 255)

        #Slider Bar
        theme.sliderPointerSpriteOff = theme.sprite('SMB/mini_off_button.png')
        theme.sliderPointerSpriteOn = theme.sprite('SMB/mini_on_button.png')
        theme.sliderBackColor = constants.BLACK
        theme.sliderPointerColorOn = constants.BLACK
        theme.sliderPointerColorOff = constants.BLACK

        #engine
        theme.text_color = constants.WHITE
        theme.conqColor = constants.BLACK
        theme.procColor = constants.GRAY
        theme.freeColor = constants.WHITE

        #icons
        theme.sound_on = theme.sprite('sound_on.png')
        theme.sound_off = theme.sprite('sound_off.png')

    elif n == constants.RESET_THEME:
        #Basic Theme
        theme.backgroundColor = (245, 245, 255)

        #button
        theme.offButtonSprite = None
        theme.offButtonSpriteMini = None
        theme.offButtonColor = None
        theme.offButtonTextColor = constants.DARK_GREEN
        theme.onButtonSprite = None
        theme.onButtonSpriteMini = None
        theme.onButtonColor = None
        theme.onButtonTextColor = constants.MED_GREEN
        theme.onButtonActualStage = constants.BLUE
        theme.offButtonActualStage = (120, 120, 255)

        #label
        theme.labelBackColor = theme.backgroundColor
        theme.labelTextColor = constants.BLACK
        theme.labelTextLowColor = constants.GRAY
        theme.labelTextLLColor = (220, 220, 220)
        theme.titleBackColor = (249, 249, 255)

        #slider Bar
        theme.sliderPointerSpriteOff = None
        theme.sliderPointerSpriteOn = None
        theme.sliderBackColor = constants.BLACK
        theme.sliderPointerColorOn = constants.BLACK
        theme.sliderPointerColorOff = constants.BLACK

        # engine
        theme.conqColor = constants.GREEN
        theme.procColor = constants.LIGHT_GREEN
        theme.freeColor = constants.WHITE
        theme.ballColor = constants.BLUE
        theme.heroColor = (220, 0, 0)

        #sounds
        theme.vol_max = 1.0
        theme.sfx_max = 1.0
        theme.menu_song = 'resources/sounds/menu.mid'
        theme.menu_vol = 1.0
        theme.game_song = 'resources/sounds/game.mid'
        theme.game_vol = 1.0
        theme.rank_song = 'resources/sounds/rank.mid'
        theme.lose_song = 'resources/sounds/lose.mid'
        theme.win_song = 'resources/sounds/win.mid'
        theme.sfx_arq = {
            'conquering': 'resources/sounds/conquering.wav',
            'conquered': 'resources/sounds/conquered.wav'
        }
        theme.sfx_list = {
            k: pygame.mixer.Sound(theme.sfx_arq[k])
            for k in theme.sfx_arq
        }
Ejemplo n.º 6
0
    'worldEmperor': 0,
    'yogaMaster': 0,
    'immortal': 0,
    'jedi': 0,
    'pilgrim': 0,
    'hacker': 0,
    'pacifist': 0,
    'serialKiller': 0,
    #settings
    'musicVolume': 100,
    'effectsVolume': 100,
    'rank': [('-', 0) for k in range(10)]
}

leftWingSprite = [
    theme.sprite('wing1Mini.png'),
    theme.sprite('wing2Mini.png'),
    theme.sprite('wing3Mini.png'),
    theme.sprite('fullWingMini.png')
]


def insert_rank():
    i['rank'].append((new_player, new_score))
    i['rank'] = sorted(i['rank'], key=lambda x: x[1])[::-1]
    i['rank'].pop(-1)


menu_vol, game_vol = 1.0, 1.0
old_music, old_sfx = 1.0, 1.0
vol_max, sfx_max = 1.0, 1.0