예제 #1
0
    def __init__(self):
        Effect.__init__(self)
        CollaborationManager.__init__(self)
        STARTING_PLAYER = 4
        STATION_WINDOW_SIZE = 3
        self.MAX_ROTATIONS = 6
        self.BALL_SIZE = 5
        self.station_window_size = STATION_WINDOW_SIZE

        # print self._get_ball_starting_position(STARTING_PLAYER)
        # x_start is the starting point for the top anchor point
        self.x_start = self._get_ball_starting_position(STARTING_PLAYER)
        # x is the current position of the bottom of the ball
        self.x = self.x_start
        # print ">>>>>>>>>>>>>>>"
        # print "INITIAL X"
        # print self.x
        # print "STATION RANGE"
        # print self._get_station_pixel_range(STARTING_PLAYER)
        # print "WINDOW"
        # print self._get_station_window(STARTING_PLAYER)
        # print "BALL POSITION"
        # print self._get_x_offset(self.x)
        # print (self._get_x_offset(self.x) + self.BALL_SIZE)
        # print ">>>>>>>>>>>>>>>"

        self.i = 0
        self.data = None
        self.direction = None
        self.speed = 0
        self.velocity = 0

        self.last_x = None
예제 #2
0
 def __init__(self,
              color=(0, 0, 0),
              column_picker=pick_mod_n,
              additive=False):
     Effect.__init__(self, )
     self.picker = column_picker
     self.color = np.array(color, dtype=np.uint8)
     self.additive = additive
예제 #3
0
 def __init__(self,
              color=(0, 255, 0),
              max_count=6,
              bottom_row=3,
              max_row=216):
     Effect.__init__(self)
     self.color = color
     self.bottom_row = bottom_row
     self.top_row_dict = {
         i: int(bottom_row + i * (max_row - bottom_row) / max_count)
         for i in range(1, max_count + 1)
     }
     self.current_level = int(bottom_row +
                              (max_row - bottom_row) / max_count)
     self.target_row = self.current_level
예제 #4
0
 def __init__(self,
              color=(255, 0, 255),
              start_col=0,
              end_col=None,
              start_row=2,
              end_row=None):
     Effect.__init__(self)
     self.color = color
     self.slice = (slice(start_row, end_row), slice(start_col, end_col))
     end_row = end_row or STATE.layout.rows
     end_col = end_col or STATE.layout.columns
     self.shape = (end_row - start_row, end_col - start_col, 3)
     self.range = 10
     self.min = 0
     self.i = 0
     print "Created with color", self.color
예제 #5
0
 def __init__(self,
              color=blue,
              dark_color=(0, 0, 0),
              light_color=(255, 255, 255),
              start_row=0,
              end_row=None,
              start_col=0,
              end_col=None):
     Effect.__init__(self)
     self.color = color
     self.light_color = light_color
     self.dark_color = dark_color
     # a grid of the row/columns of all 0's
     self.previous_ripple_state = np.zeros((STATE.layout.rows, STATE.layout.columns), int)
     self.ripple_state = np.zeros((STATE.layout.rows, STATE.layout.columns), int)
     # self.ripple_state[2, 16] = 50
     self.damping = 0.8
     self.frameCount = 0
예제 #6
0
    def __init__(
        self,
        buttons_colors=None,  # Button colors. Defaults to RED, GREEN, BLUE, YELLOW, WHITE
        num_stations=6,  # Deprecated
        draw_bottom_layer=True,  # Turn the bottom layer on or off
        flash_rate=10,  # Flash on (or off) every X frames
        # Time to hit before picking a new one (if backwards_progress, also lose progress)
        selection_time=1):

        # TODO Is this super initialization needed? Probably not, but future-proofs it
        Effect.__init__(self)
        CollaborationManager.__init__(self)

        # Don't use a dictionary as a default argument (mutable)
        if buttons_colors is None:
            buttons_colors = {
                0: (255, 0, 0),
                1: (0, 255, 0),
                2: (0, 0, 255),
                3: (255, 255, 0),
                4: (255, 255, 255)
            }

        self.button_colors = buttons_colors
        self.draw_bottom_layer = draw_bottom_layer
        self.flash_rate = flash_rate
        self.backwards_progress = None
        self.selection_time = selection_time

        # TODO Get from STATE
        self.num_stations = num_stations
        self.num_buttons = len(buttons_colors)
        self.all_combos = [
            c for c in product(range(num_stations), buttons_colors.keys())
        ]

        # These all get set in the reset_state method called during scene initialization
        self.on = None
        self.off = []
        self.next_button = None
        self.flash_timer = 0
예제 #7
0
    def __init__(self, strip_bottom=5, strip_top=20):
        Effect.__init__(self)
        self.target_location = 15  # Moved to not deal with wrap-around case at 2am
        # self.rotation_speed = .5 # rotation / second
        self.sprite_location = 20
        self.direction = 1
        self.hit_countdown = 0
        self.sprite_color = BLUE

        # Framework currently does not support args to vary effects, but when it does, this will come in handy
        self.strip_bottom = strip_bottom
        self.strip_top = strip_top

        self.bottom_rows = set(
            reduce(lambda a, b: a + b, [
                STATE.layout.row[i]
                for i in range(self.strip_bottom, self.strip_top)
            ]))
        self.target_idx = self.bottom_rows & set(
            STATE.layout.slice[self.target_location])

        self.max_slice = max(STATE.layout.slice)
예제 #8
0
 def __init__(self, max_in=100):
     Effect.__init__(self)
     self.color_scale = 255.0 / max_in
     self.row_scale = 216.0 / max_in
예제 #9
0
 def __init__(self, rate=1.0, bottom_row=0, top_row=None):
     Effect.__init__(self)
     self.frame = 0
     self.rate = rate
     self.row_slice = slice(bottom_row, top_row)
예제 #10
0
 def __init__(self, color=(255, 0, 0), start_col=0, end_col=None, start_row=0, end_row=None):
     Effect.__init__(self)
     self.color = color
     self.slice = (slice(start_row, end_row), slice(start_col, end_col))
     print "Created with color", self.color
예제 #11
0
 def __init__(self, spark_rad=8, t=0):
     Effect.__init__(self)
     self.spark_rad = spark_rad
     self.start_time = t