Beispiel #1
0
    def __init__(self, screen_rect, spacer_y=None):
        self.spacer_y = spacer_y
        self.is_die2 = spacer_y
        sheet = prepare.GFX['dice']
        self.dice = tools.strip_from_sheet(sheet, (0,0), (36,36), 1, 6)
        self.dice_rect = self.dice[0].get_rect()
        self.rolling = False

        self.roll_value = 0
        dice_buffer_x = 15
        if not spacer_y:
            self.dice_starting_pos = (screen_rect.right, screen_rect.centery - (screen_rect.height //4) + dice_buffer_x)
        else:
            self.dice_starting_pos = (screen_rect.right, screen_rect.centery - (screen_rect.height //4) + dice_buffer_x + spacer_y)
        self.dice_timer = 0
        self.dice_speed = 40
        self.dice_moving_left = True
        self.draw_dice = False #player has rolled initially

        dice_large_offset = 125
        x = 1050
        y = 100
        if self.is_die2: #on only second die
            x += dice_large_offset
        self.dice_large_pos = (x,y)

        self.dice_large = []
        for die in self.dice:
            self.dice_large.append(pg.transform.scale(die, (100,100)))
Beispiel #2
0
    def __init__(self, screen_rect, spacer_y=None):
        self.spacer_y = spacer_y
        self.is_die2 = spacer_y
        sheet = prepare.GFX['dice']
        self.dice = tools.strip_from_sheet(sheet, (0, 0), (36, 36), 1, 6)
        self.dice_rect = self.dice[0].get_rect()
        self.rolling = False

        self.roll_value = 0
        dice_buffer_x = 15
        if not spacer_y:
            self.dice_starting_pos = (screen_rect.right, screen_rect.centery -
                                      (screen_rect.height // 4) +
                                      dice_buffer_x)
        else:
            self.dice_starting_pos = (screen_rect.right, screen_rect.centery -
                                      (screen_rect.height // 4) +
                                      dice_buffer_x + spacer_y)
        self.dice_timer = 0
        self.dice_speed = 40
        self.dice_moving_left = True
        self.draw_dice = False  #player has rolled initially

        dice_large_offset = 125
        x = 1050
        y = 100
        if self.is_die2:  #on only second die
            x += dice_large_offset
        self.dice_large_pos = (x, y)

        self.dice_large = []
        for die in self.dice:
            self.dice_large.append(pg.transform.scale(die, (100, 100)))
Beispiel #3
0
 def make_navigation_buttons(self, screen_rect):
     sheet = prepare.GFX["nav_buttons"]
     size = (106, 101)
     y = 790
     from_center = 15
     icons = tools.strip_from_sheet(sheet, (0, 0), size, 4)
     buttons = ButtonGroup()
     l_kwargs = {
         "idle_image": icons[0],
         "hover_image": icons[1],
         "call": self.scroll_page,
         "args": 1,
         "bindings": [pg.K_LEFT, pg.K_KP4]
     }
     r_kwargs = {
         "idle_image": icons[2],
         "hover_image": icons[3],
         "call": self.scroll_page,
         "args": -1,
         "bindings": [pg.K_RIGHT, pg.K_KP6]
     }
     left = Button(((0, y), size), buttons, **l_kwargs)
     left.rect.right = screen_rect.centerx - from_center
     right = Button(((0, y), size), buttons, **r_kwargs)
     right.rect.x = screen_rect.centerx + from_center
     return buttons
Beispiel #4
0
 def __init__(self):
     self.point_chip_loc = craps_data.POINT_CHIP_LOC
     sheet = prepare.GFX['point_chip']
     self.point_chip = tools.strip_from_sheet(sheet, (0,0), (135,135), 1, 2)
     self.off = pg.transform.scale(self.point_chip[0], (40,40))
     self.on = pg.transform.scale(self.point_chip[1], (40,40))
     self.image = self.off
     self.rect = self.off.get_rect(center=self.point_chip_loc['0'])
     self.timer = 0
     self.speed = 10
     self.point = None
Beispiel #5
0
 def __init__(self):
     self.point_chip_loc = craps_data.POINT_CHIP_LOC
     sheet = prepare.GFX['point_chip']
     self.point_chip = tools.strip_from_sheet(sheet, (0, 0), (135, 135), 1,
                                              2)
     self.off = pg.transform.scale(self.point_chip[0], (40, 40))
     self.on = pg.transform.scale(self.point_chip[1], (40, 40))
     self.image = self.off
     self.rect = self.off.get_rect(center=self.point_chip_loc['0'])
     self.timer = 0
     self.speed = 10
     self.point = None
Beispiel #6
0
 def make_navigation_buttons(self, screen_rect):
     sheet = prepare.GFX["nav_buttons"]
     size = (106,101)
     y = 790
     from_center = 15
     icons = tools.strip_from_sheet(sheet, (0,0), size, 4)
     buttons = ButtonGroup()
     l_kwargs = {"idle_image" : icons[0], "hover_image" : icons[1],
                 "call" : self.scroll_page, "args" : 1,
                 "bindings" : [pg.K_LEFT, pg.K_KP4]}
     r_kwargs = {"idle_image"  : icons[2], "hover_image" : icons[3],
                 "call" : self.scroll_page, "args" : -1,
                 "bindings" : [pg.K_RIGHT, pg.K_KP6]}
     left = Button(((0,y),size), buttons, **l_kwargs)
     left.rect.right = screen_rect.centerx-from_center
     right = Button(((0,y),size), buttons, **r_kwargs)
     right.rect.x = screen_rect.centerx+from_center
     return buttons
Beispiel #7
0
    def __init__(self):
        super(Keno, self).__init__()
        self.screen_rect = pg.Rect((0, 0), prepare.RENDER_SIZE)
        self.game_started = False
        self.font = prepare.FONTS["Saniretro"]
        self.advisor = KenoAdvisor()
        self.mock_label = Label(self.font, 64, 'KENO [WIP]', 'gold3',
                                {'center': (672, 102)})

        b_width = 360
        b_height = 90
        side_margin = 10
        w = self.screen_rect.right - (b_width + side_margin)
        h = self.screen_rect.bottom - (b_height + 15)
        self.buttons = ButtonGroup()
        NeonButton((w, h), "Lobby", self.back_to_lobby, None, self.buttons)

        self.turns = 16
        self.play_max_active = False

        ball_path = os.path.join('resources', 'keno', 'balls', '64x64',
                                 'sheet.png')
        ball_sheet = pg.image.load(ball_path).convert_alpha()
        self.balls = tools.strip_from_sheet(ball_sheet, (0, 0), (64, 64), 10,
                                            8)

        self.keno_card = KenoCard(self.balls)
        #self.keno_card = KenoCard() -- no ball graphics

        self.prev_spot_count = 0

        self.pay_table = PayTable(self.keno_card)
        self.pay_table.update(0)

        self.round_history = RoundHistory(self.keno_card)

        self.alert = None

        self.quick_picking = Action(
            pg.Rect(370, 760, 150, 75),
            Label(self.font, 32, 'QUICK PICK', 'gold3', {'center': (0, 0)}),
            self.activate_quick_pick)

        self.betting = Action(
            pg.Rect(682, 760, 150, 75),
            Label(self.font, 32, 'BET 1', 'gold3', {'center': (0, 0)}),
            self.activate_bet)

        self.clearing = Action(
            pg.Rect(526, 760, 150, 75),
            Label(self.font, 32, 'CLEAR', 'gold3', {'center': (0, 0)}),
            self.activate_clear)

        self.playing = Action(
            pg.Rect(838, 760, 156, 75),
            Label(self.font, 32, 'PLAY', 'gold3', {'center': (0, 0)}),
            self.activate_play)

        self.playing_max = Action(
            pg.Rect(838, 840, 156, 75),
            Label(self.font, 32, 'PLAY MAX', 'gold3', {'center': (0, 0)}),
            self.activate_playmax)

        self.actions = {
            'quick pick': self.quick_picking,
            'betting': self.betting,
            'clearing': self.clearing,
            'playing': self.playing,
            'playing max': self.playing_max,
        }

        self.gui_widgets = {
            'title': self.mock_label,
            'card': self.keno_card,
            'quick_pick': self.quick_picking,
            'play': self.playing,
            'play_max': self.playing_max,
            'pay_table': self.pay_table,
            'round_history': self.round_history,
            'balance': None,
            'bet_action': None,
            'clear': None,
            'bet': None,
            'won': None,
            'spot': None,
        }
Beispiel #8
0
    def __init__(self):
        super(Keno, self).__init__()
        self.screen_rect = pg.Rect((0, 0), prepare.RENDER_SIZE)
        self.game_started = False
        self.font = prepare.FONTS["Saniretro"]
        self.advisor = KenoAdvisor()
        self.mock_label = Label(self.font, 64, 'KENO [WIP]', 'gold3', {'center':(672,102)})

        b_width = 360
        b_height = 90
        side_margin = 10
        w = self.screen_rect.right - (b_width + side_margin)
        h = self.screen_rect.bottom - (b_height+15)
        self.buttons = ButtonGroup()
        NeonButton((w, h), "Lobby", self.back_to_lobby, None, self.buttons)

        self.turns = 16
        self.play_max_active = False

        ball_path = os.path.join('resources', 'keno', 'balls', '64x64', 'sheet.png')
        ball_sheet = pg.image.load(ball_path).convert_alpha()
        self.balls = tools.strip_from_sheet(ball_sheet, (0,0), (64,64), 10, 8)

        self.keno_card = KenoCard(self.balls)
        #self.keno_card = KenoCard() -- no ball graphics

        self.prev_spot_count = 0

        self.pay_table = PayTable(self.keno_card)
        self.pay_table.update(0)

        self.round_history = RoundHistory(self.keno_card)

        self.alert = None


        self.quick_picking = Action(pg.Rect(370, 760, 150, 75),
                                    Label(self.font, 32, 'QUICK PICK', 'gold3', {'center':(0,0)}),
                                    self.activate_quick_pick)


        self.betting = Action(pg.Rect(682, 760, 150, 75),
                              Label(self.font, 32, 'BET 1', 'gold3', {'center':(0,0)}),
                              self.activate_bet)

        self.clearing = Action(pg.Rect(526, 760, 150, 75),
                               Label(self.font, 32, 'CLEAR', 'gold3', {'center':(0,0)}),
                               self.activate_clear)

        self.playing = Action(pg.Rect(838, 760, 156, 75),
                              Label(self.font, 32, 'PLAY', 'gold3', {'center':(0,0)}),
                              self.activate_play)

        self.playing_max = Action(pg.Rect(838, 840, 156, 75),
                                  Label(self.font, 32, 'PLAY MAX', 'gold3', {'center':(0,0)}),
                                  self.activate_playmax)

        self.actions = {
            'quick pick'    : self.quick_picking,
            'betting'       : self.betting,
            'clearing'      : self.clearing,
            'playing'       : self.playing,
            'playing max'   : self.playing_max,
        }

        self.gui_widgets = {
            'title'         : self.mock_label,
            'card'          : self.keno_card,
            'quick_pick'    : self.quick_picking,
            'play'          : self.playing,
            'play_max'      : self.playing_max,
            'pay_table'     : self.pay_table,
            'round_history' : self.round_history,
            'balance'       : None,
            'bet_action'    : None,
            'clear'         : None,
            'bet'           : None,
            'won'           : None,
            'spot'          : None,
        }