Exemple #1
0
    def __init__(self, position, listener):
        super(CancelButton, self).__init__(position, listener)

        self.button_up_image = game.get_image('cancel_up')
        self.button_down_image = game.get_image('cancel_down')
        self.set_image(self.button_up_image)
        self.set_surface(self.image.get_width(), self.image.get_height())
Exemple #2
0
    def __init__(self, position, mode=1):
        super(Block, self).__init__(position)

        self.mode = mode

        self.set_image(game.get_image('block_red'))

        self.icon = Actor((64, 64))
        self.icon.set_image(game.get_image('icon_%s' % self.mode))

        self.state = 'input'
        self.state_time = 0
        self.target = np.array((0, 0))
        self.start_position = np.array((0, 0))
Exemple #3
0
    def __init__(self, position):
        super(Button, self).__init__(position)

        self.button_up_image = game.get_image('screen_empty')
        self.button_down_image = game.get_image('screen_active')
        self.set_image(self.button_up_image)

        self.is_pressed = False
        self.wait_time = 0

        self.hand_surface = pg.Surface((256, 256))
        self.hand_rect = self.hand_surface.get_rect()

        self.label_text = Line((315, 450), '?', game.get_font('screen_small'))
        self.label_text.set_color(pg.Color(50, 240, 0))
Exemple #4
0
    def __init__(self, position, listener, activator, index=0):
        super(Cursor, self).__init__(position)

        self.listener = listener
        self.activator = activator
        self.index = index

        self.key = None
        self.set_image(game.get_image('cursor_block'))

        self.text = Line((64, 72), self.key, game.get_font('screen_large'))
        self.text.set_color(pg.Color(62, 255, 4))

        self.start_pos = np.array(position)

        self.state = 'input'
        self.state_time = 0.0

        self.progress_time = 0

        self.load_icon = AnimatedActor((64, 64), mode='custom')
        self.load_icon.set_animation(game.get_animation('load'), (64, 64), 20)
        self.load_icon_rect = self.load_icon.surface.get_rect()

        game.key_down.subscribe(self.key_down)
Exemple #5
0
    def __init__(self, position, listener):
        super(Button, self).__init__(position)

        self.button_up_image = game.get_image('button_up')
        self.button_down_image = game.get_image('button_down')
        self.set_image(self.button_up_image)

        self.is_pressed = False
        self.is_key_down = False
        self.pressed_time = 0.0
        self.wait_time = 1.2

        self.button_pressed = Event()
        self.button_pressed.subscribe(listener)

        game.key_down.subscribe(self.key_down)
Exemple #6
0
    def __init__(self):
        super(Cursor, self).__init__((100, 100))

        self.set_image(game.get_image('cursor_standard'))

        self.velocity = np.array((0, 0))

        game.cursor_down.subscribe(self.cursor_down)
        game.cursor_up.subscribe(self.cursor_up)

        self.load_icon = AnimatedActor((64, 96), mode='one_shot')
        self.load_icon.set_animation(game.get_animation('load'), (64, 64), 20)
        self.load_icon_rect = self.load_icon.surface.get_rect()

        self.is_down = False
        self.button_type = None
Exemple #7
0
 def increase_mode(self, n):
     self.mode = (self.mode + n) % 3
     self.icon.set_image(game.get_image('icon_%s' % self.mode))
Exemple #8
0
 def cursor_up(self):
     self.set_image(game.get_image('cursor_standard'))
     self.is_down = False
Exemple #9
0
    def cursor_down(self, button_type=None):
        self.set_image(game.get_image('cursor_press'))
        self.load_icon.start_animation()

        self.is_down = True
        self.button_type = button_type