def __init__(self, parent):
        Location.__init__(self, parent, menu_background)
        
        pygame.mixer.music.load(music)
        pygame.mixer.music.play(-1)
        
        pygame.mouse.set_visible(1)
        pygame.key.set_repeat(0)


        self.start_button = PlayButton(240, 300)

        self.surfaces = []
        self.controls = pygame.sprite.Group()
        self.controls.add(self.start_button)
        
        self.platform1 = Platform(120, 600)
        self.platform2 = Platform(240, 490)
        self.platform3 = Platform(360, 550)
        self.doodle = Doodle()

        self.animation = pygame.sprite.Group()
        self.animation.add(self.platform1)
        self.animation.add(self.platform2)
        self.animation.add(self.platform3)
        self.animation.add(self.doodle)

        self.window.blit(self.background, (0, 0))
Beispiel #2
0
    def load_map(self, folder, name):
        #This should be read from layout.txt
        self.spawn_x = 50
        self.spawn_y = 50

        #opens an .oel file and create map from it
        tree = ET.parse(os.path.join('data', 'maps', folder, name))
        root = tree.getroot()
        self.camera.map_w = int(root.attrib['width'])
        self.camera.map_h = int(root.attrib['height'])
        for r in root:

            for o in r:
                if o.tag == 'tile':
                    size = 25
                    target = Platform(
                        int(o.attrib['x']) * size,
                        int(o.attrib['y']) * size, int(o.attrib['tx']),
                        int(o.attrib['ty']), size)
                    self.platforms.append(target)

                else:

                    target = Object(int(o.attrib['x']),
                                    int(o.attrib['y']),
                                    o.tag + '.png',
                                    colorkey=None,
                                    folder='maps')
                    target.set_message('This is a ' + o.tag)
                    self.objects.append(target)

                self.entity.append(target)

        return self
Beispiel #3
0
    def create_platforms(self):
        platform_x = random.randint(SC.platform_range[0], SC.platform_range[1])

        platform_position1 = (platform_x, SC.platform_start_y)
        platform_position2 = (platform_x + SC.platform_width +
                              SC.platform_gap_size, SC.platform_start_y)

        hammer_x = random.randint(SC.platform_range[0], SC.platform_range[1])
        hammer_position1 = (platform_x + .9 * SC.platform_width -
                            Hammer.default_width,
                            SC.platform_start_y + SC.platform_height)

        hammer_position2 = (platform_x + SC.platform_width +
                            SC.platform_gap_size + .1 * SC.platform_width,
                            SC.platform_start_y + SC.platform_height)

        first_platform = Platform(platform_position1, SC.platform_velocity)
        self.platforms.append(first_platform)
        second_platform = Platform(platform_position2, SC.platform_velocity)
        self.platforms.append(second_platform)

        first_hammer = Hammer(hammer_position1, SC.platform_velocity)
        self.hammers.append(first_hammer)
        second_hammer = Hammer(hammer_position2, SC.platform_velocity)
        self.hammers.append(second_hammer)
Beispiel #4
0
def run_game():
    #Инициализация игры и создание объекта на экране
    #timer = pygame.time.Clock()
    pygame.init()
    ai_setting = Settings()
    screen = pygame.display.set_mode(
        (ai_setting.screen_width, ai_setting.screen_height))
    pygame.display.set_caption("Arcanoid")
    platform = Platform(ai_setting, screen)
    bricks = Group()
    ball = Ball(ai_setting, screen, platform, bricks)

    #блок музыки - начало игры
    music_file = "mus/title.mp3"
    pygame.mixer.music.load(music_file)
    pygame.mixer.music.play()  #Проигрываем5
    #

    # Create the wall of bricks.
    gameF.create_wall(ai_setting, screen, platform, bricks)

    #Запуск основного цикла в игре
    while True:
        #    timer.tick(240)
        if (ai_setting.life == 0):

            break
        gameF.checkEvents(platform)  #Функция реагирования на события
        platform.update()  #Обновление платформы
        ball.update()  #Обновление мяча

        gameF.updateScreen(ai_setting, screen, platform, ball,
                           bricks)  #Функция перерисовки экрана
Beispiel #5
0
    def __init__(self, player):
        teleporter = Teleporter()
        # Call the parent constructor
        Level.__init__(self, player)

        self.level_limit = 1500

        # Array with type of platform, and x, y location of the platform.
        level = [
            [210, 70, 450, 770],
            [210, 70, 850, 520],
            [210, 70, 1000, 420],
            [210, 70, 1120, 580],
        ]

        # Go through the array above and add platforms
        for platform in level:
            block = Platform(platform[0], platform[1])
            block.rect.x = platform[2]
            block.rect.y = platform[3]
            block.player = self.player
            self.platform_list.add(block)
        teleporter.rect.x = self.level_limit
        teleporter.rect.y = 50
        self.teleporter_list.add(teleporter)
Beispiel #6
0
def platsassemble(levelnow,levelindex):
    for p in range(len(levelnow)):
        platform = Platform(levelnow[p])
        platform.harvesthour(mapsizes[levelindex][0],mapsizes[levelindex][1])
        wall_list.add(platform)
        sprite_list.add(platform)
        print(str(levelnow[p]))
Beispiel #7
0
    def load_map(self,folder,name):
        #This should be read from layout.txt
        self.spawn_x = 50
        self.spawn_y = 50
        
        #opens an .oel file and create map from it
        tree = ET.parse(os.path.join('data','maps',folder,name))
        root = tree.getroot()
        self.camera.map_w = int(root.attrib['width'])
        self.camera.map_h = int(root.attrib['height'])
        for r in root:

            for o in r:
                if o.tag == 'tile':
                    size = 25
                    target = Platform(int(o.attrib['x'])*size,int(o.attrib['y'])*size,int(o.attrib['tx']),int(o.attrib['ty']),size)
                    self.platforms.append(target)
                
                else:
                    
                    target = Object(int(o.attrib['x']),int(o.attrib['y']),o.tag+'.png',colorkey=None,folder='maps')
                    target.set_message('This is a ' + o.tag)
                    self.objects.append(target)
                
                self.entity.append(target)

        return self
Beispiel #8
0
 def __init__(self, player):
     teleporter = Teleporter()
     # Call the parent constructor
     Level.__init__(self, player)
     self.level_limit = 2000
     # Array with width, height, x, and y of platform
     level = [[210, 40, 500, 650], [210, 40, 900, 600],
              [210, 40, 1200, 550], [210, 40, 1400, 450],
              [1000, 40, 2010, 795], [1000, 40, 2010, 795]]
     # Go through the array above and add platforms
     for platform in level:
         block = Platform(platform[0], platform[1])
         block.rect.x = platform[2]
         block.rect.y = platform[3]
         block.player = self.player
         self.platform_list.add(block)
         teleporter.rect.x = 1000
         teleporter.rect.y = 620
         self.teleporter_list.add(teleporter)
     # X and Y coordinates for generating enemies
     enemy_list = []
     enemy_level = [[230, 420], [500, 420], [800, 300]]
     for n in enemy_level:
         enemy = Enemy()
         enemy.rect.x = n[0]
         enemy.rect.y = n[1]
         self.enemy_list.add(enemy)
     #X and Y for the score chests
     chest_list = []
     chest_level = [[300, 100], [550, 300]]
     for n in chest_level:
         chest = Chest()
         chest.rect.x = n[0]
         chest.rect.y = n[1]
         self.chest_list.add(chest)
Beispiel #9
0
def platsassemble(levelnow, levelindex):
    for p in range(len(levelnow)):
        platform = Platform(levelnow[p])
        platform.harvesthour(mapsizes[levelindex][0], mapsizes[levelindex][1])
        wall_list.add(platform)
        sprite_list.add(platform)
        print(str(levelnow[p]))
Beispiel #10
0
        def start_game(self):
            try:

                if self.reRun:
                    if self.death_text != None:
                        self.Scen.removeItem(self.death_text)
                        self.death_text = None
                    if self.win_text != None:
                        self.Scen.removeItem(self.win_text)
                        self.win_text = None
                    self.test_player.setY(-60)
                    self.test_player = Player(self.player_specs)
                    self.backGround = Background(-1, -1, self.window_width + 1,
                                                 self.window_height + 1)
                    self.skyObject = self.backGround.skyObj
                    self.bottom_lava = Lava(-1, self.window_height - 50,
                                            self.window_width + 1, 51)
                    self.test_platform = Platform(0, 300,
                                                  self.window_width - 100, 40)
                    self.test_platform_2 = Platform(self.window_width - 50,
                                                    320, 100, 35)
                    self.init_game_screen()
                    self.completion = 0
                    self.goal_added = False

                self.view.setScene(self.scene)

                self.game_timer.start(10)
            except Exception as r:
                print('JJJJJJJJ')
 def __init__(self, player):
     '''call parent constructor'''
     Level.__init__(self, player)
     self.level_limit = -10000
     '''array with with width, height, x, and y of platform'''
     level = [
         [210, 70, 500, 500],
         [210, 70, 800, 400],
         [210, 70, 1120, 280],
         [210, 70, 2000, 300],
         [210, 70, 1800, 500],
         [210, 70, 2900, 400],
     ]
     walls = [[70, 600, 0, 0], [70, 600, 3200, 0]]
     '''go through the array and add platforms'''
     for platform in level:
         block = Platform(platform[0], platform[1])
         block.rect.x = platform[2]
         block.rect.y = platform[3]
         block.player = self.player
         self.platform_list.add(block)
     '''do the same for level walls'''
     for wall in walls:
         block = Wall(wall[0], wall[1])
         block.rect.x = wall[2]
         block.rect.y = wall[3]
         block.player = self.player
         self.walls_list.add(block)
     '''add enemies to level'''
     self.enemy_list.add(Enemy())
     self.enemy_list.add(Enemy())
Beispiel #12
0
 def load_platforms(self):
     platforms = set()
     if self.stageName == 'first':
         left = Platform(470, 490, 246, 10, platforms, 0)  #530
         right = Platform(1196, 490, 246, 10, platforms, 0)
         top = Platform(833, 330, 246, 10, platforms, 0)  # 408
         floor = Platform(290, 710, 1360, 18, platforms, 1)
         return platforms
Beispiel #13
0
 def __init__(self):
     self.win = Window((Game.win_width, Game.win_height))
     self.sky = Sky(Game.win_width, Game.win_height)
     self.platform = Platform(Game.win_width, 96, Game.win_height - 96 - 30)
     self.dino = None
     self.enemy_velocity = 250
     self.score = 0
     self.create_handlers()
     self.enemies = []
Beispiel #14
0
 def createExit(self, j, i):
     self.stageScale = 50
     x = self.stageScale * (j)
     y = self.stageScale * (i)
     sprite = Platform()
     sprite.rect = pygame.Rect((x, y), (self.stageScale, self.stageScale))
     sprite.image = self.imageDictionary["goldBrick"]
     sprite.image = pygame.transform.scale(sprite.image, (self.stageScale, self.stageScale))
                                            
     self.exitGroup.add(sprite);
Beispiel #15
0
 def __init__(self):
     setWindowPositionCentered(self.width, self.height)
     self.window = pygame.display.set_mode((self.width, self.height))
     pygame.display.set_caption("Ping Pong!")
     pygame.font.init()
     
     # Instantiates components
     self.ball = Ball(self.window)
     platformsX = (350 - 60) // 2
     self.topPlatform = Platform(self.window, platformsX, 0)
     self.bottomPlatform = Platform(self.window, platformsX, 480)
     self.score = Score(self.window)
Beispiel #16
0
    def __init__(self,
                 numchannels,
                 accumulation_length,
                 bandwidth,
                 input_bitwidth,
                 fft_out_bitwidth,
                 antennas=1):
        self.maxdesigns = 1
        self.blocks = {}
        self.totalblocks = 0

        #add the platform array
        self.platforms = {}

        # add platforms: cost, inputbw, outputbw, resources
        self.platforms['ROACH'] = Platform.createRoach('dollars')
        self.platforms['GTX580'] = Platform.createGTX580Server('dollars')
        #self.platforms['IBOB'] = Platform('IBOB',2000,10,1,['resources'])

        # add the ADC
        adc_bw = bandwidth * input_bitwidth
        self.blocks['ADC'] = CBlock(
            'ADC', CBlock.getADCModel(self.platforms, bandwidth,
                                      input_bitwidth), -1, 0, 0, 'PFB', 0,
            adc_bw, antennas)
        self.totalblocks += antennas

        # add the PFB
        pfb_bw = bandwidth * 32
        self.blocks['PFB'] = CBlock(
            'PFB',
            CBlock.getPFBModel(self.platforms, bandwidth, input_bitwidth,
                               numchannels), 'ADC', 0, pfb_bw, 'FFT', 0,
            adc_bw, antennas)
        self.totalblocks += antennas

        # add the FFT
        fft_out_bandwidth = bandwidth * fft_out_bitwidth
        self.blocks['FFT'] = CBlock(
            'FFT', CBlock.getFFTModel(self.platforms, bandwidth, numchannels),
            'PFB', 0, pfb_bw, 'VAcc', 0, fft_out_bandwidth, antennas)
        self.totalblocks += antennas

        #add the Vacc
        self.blocks['VAcc'] = CBlock(
            'VAcc',
            CBlock.getVAccModel(self.platforms, bandwidth, fft_out_bitwidth,
                                accumulation_length), 'FFT', 0,
            fft_out_bandwidth, -1, 0, 0, antennas)
        self.totalblocks += antennas
Beispiel #17
0
def frametest():
    p = Platform()
    a = testScreen(p, p.frontdisplay)
    # a = VUScreen(p, p.frontdisplay, 0.5)
    l = p.chLogic()
    print( "testScreen initialised: ", a, p )
    print"logic ", l
    for k in l:

        p.activeSource= l[k]
        p.frontdisplay.draw(a.draw)
        time.sleep(3)

    print( "testScreen draw executed")
Beispiel #18
0
def main():
    pygame.init()
    
    
    width, height = 1600, 900
    screen = pygame.display.set_mode((width, height),pygame.FULLSCREEN)
  
    player = Player()
    plat0 = Platform()
    player.setX(800)
    player.setY(387)
    while 1:
        
        screen.fill(0)
    
        
        player.update()
        screen.blit(player.getImage(), (player.getX(),player.getY()))
        screen.blit(plat0.getImage(),(20,450))  

        

        pygame.display.flip()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit(0)
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_a:
                    player.setXSpeed(-1)
                    
                if event.key == pygame.K_d:
                    player.setXSpeed(1)

                if event.key == pygame.K_k:
                    player.setJumping(True)
                    player.wdown = True
                     

            if event.type == pygame.KEYUP:
                if event.key == pygame.K_a and player.getXSpeed() < 0:
                    player.setXSpeed(0)
                    player.facingLeft = True
                if event.key == pygame.K_d and player.getXSpeed() > 0:
                    player.setXSpeed(0)
                    player.facingLeft == False
                if event.key == pygame.K_k:
                    
                    player.wdown = False
 def get_sprites(self):
     platforms_group = pygame.sprite.Group()
     for x in range(len(self.level_array)):
         for y in range(len(self.level_array[0])):
             if self.level_array[x, y] == 1:
                 platforms_group.add(Platform(y * 20, x * 20, 20, 20, self))
     return platforms_group
Beispiel #20
0
def generating_platforms(group, going):
    """Генерация платформ"""
    y = 5
    while y < HEIGHT:
        generate_platform(group, y)
        y += going
    Platform(group, 200, 600)
Beispiel #21
0
	def gen_platform(self, plat):
		# Left side of platform
		plat_l = Platform(plat[0], plat[1])
		plat_l.rect.x = 0
		plat_l.rect.y = plat[2]
		plat_l.player = self.player
		
		# Right side of platform
		plat_r = Platform(SCREEN_WIDTH - plat[0] - GAP_LEN, plat[1])
		plat_r.rect.x = plat[0] + GAP_LEN
		plat_r.rect.y = plat[2]
		plat_r.player = self.player
		
		# Add both platforms to platform_list
		self.platform_list.add(plat_l)
		self.platform_list.add(plat_r)
Beispiel #22
0
def setPlatform(x,y,size, image):
    for i in range(size):
        platforms.append( Platform())
        platforms[len(platforms)-1].set_dimensions(50, 50) 
        platforms[len(platforms)-1].x_pos = x+i*50
        platforms[len(platforms)-1].y_pos = y
        platformImages.append(image)
Beispiel #23
0
    def new(self):
        self.all_sprites = pg.sprite.Group()
        self.platforms = pg.sprite.Group()
        self.saws = pg.sprite.Group()

        plts_conf, plr_conf, saw_conf, fl_saw_conf, prtl_conf = self.create_level(
            levels.level1)

        self.player = Player(*plr_conf, self)
        self.all_sprites.add(self.player)

        for plt in plts_conf:
            p = Platform(*plt)
            self.all_sprites.add(p)
            self.platforms.add(p)

        for saw in saw_conf:
            s = Saw(*saw)
            self.all_sprites.add(s)
            self.saws.add(s)

        for fl_saw in fl_saw_conf:
            s = FlyingSaw(*fl_saw, self.platforms)
            self.all_sprites.add(s)
            self.saws.add(s)

        self.portal = Portal(*prtl_conf)
        self.all_sprites.add(self.portal)

        self.run()
Beispiel #24
0
def create_object(ch, x, y):
    if ch in ['1', '2', '3', '4', '5']:
        obj = Jelly(ord(ch) - ord('1'), x, y)
        gfw.world.add(gfw.layer.item, obj)
        #print('creating Jelly', x, y)
    elif ch in ['O', 'P']:
        dy = 1 if ch == 'Q' else 3
        y -= dy * BLOCK_SIZE // 2
        x -= BLOCK_SIZE // 2
        obj = Platform(ord(ch) - ord('O'), x, y)
        gfw.world.add(gfw.layer.platform, obj)
        #print('creating Platform', x, y)
    elif ch in ['B']:
        pass
    else:
        ao = factory.create(ch, x, y)
        if ao is None:
            global ignore_char_map
            if ch not in ignore_char_map:
                print("Error? I don't know about: '%s'" % ch)
                ignore_char_map |= {ch}
            return
        l, b, r, t = ao.get_bb()
        ao.pass_wh(r - l, t - b)
        gfw.world.add(gfw.layer.enemy, ao)
Beispiel #25
0
    def randomPlatform(self, top=True):
        x = random.randint(0, screen_width - platform_width)
        bad_y = []

        for spr in self.allsprites:
            bad_y.append((spr.y - platform_y_padding, spr.y + platform_y_padding + spr.rect.height))
    
        good = 0
        while not good:
            if top:
                y = random.randint(-100, 100)
            else:
                y = random.randint(0, screen_height)

            good = 1
            for bad_y_item in bad_y:
                if bad_y_item[0] <= y <= bad_y_item[1]:
                    good = 0
                    break

        dig = random.randint(0, 100)
        if dig < 35:
            return MovingPlatform(x, y)
        elif 35 <= dig < 50:
            return CrashingPlatform(x, y) 
        else:
            return Platform(x, y)
    def __init__(self, world):
        self.__world = world
        self.__platforms = pg.sprite.Group()
        self.__items = pg.sprite.Group()
        self.__exit = pg.sprite.Group()
        self.__bg = (BLUE)

        row_count = 0
        for row in self.__world:
            col_count = 0
            for tile in row:
                if tile == 1:
                    wall = Platform(col_count * TILE_SIZE_W,
                                    row_count * TILE_SIZE_H, TILE_SIZE_W,
                                    TILE_SIZE_H, BLUE)
                    self.__platforms.add(wall)
                    #tile = (wall.image, wall.rect)
                elif tile == 2:
                    grogu = Key(col_count * TILE_SIZE_W,
                                row_count * TILE_SIZE_H, 20, 20, GREEN)
                    self.__items.add(grogu)
                elif tile == 3:
                    ship = Extraction_point(col_count * TILE_SIZE_W,
                                            row_count * TILE_SIZE_H,
                                            TILE_SIZE_W, TILE_SIZE_H, PURPLE)
                    self.__exit.add(ship)
                col_count += 1
            row_count += 1

        self.__spawn_point = ((WIDTH, HEIGHT))
Beispiel #27
0
def load_map_level(map_name, x_player, y_player):
    global sprites, platforms, level, hero, camera

    sprites = pygame.sprite.Group()
    platforms = list()
    level = load_level(map_name)
    hero = Player(x_player, y_player)
    sprites.add(hero)
    x = 0
    y = 0
    for row in level:
        for col in row:
            if col == "#":
                pf = Platform(x, y)
                sprites.add(pf)
                platforms.append(pf)
            elif col == '@':
                fin = Final(x, y)
                sprites.add(fin)
                platforms.append(fin)
            x += PLATFORM_WIDTH
        y += PLATFORM_HEIGHT
        x = 0

    total_level_width = len(level[0]) * PLATFORM_WIDTH
    total_level_height = len(level) * PLATFORM_HEIGHT
    camera = Camera(camera_configure, total_level_width, total_level_height)
Beispiel #28
0
	def __init__(self, conf):
		Platform.__init__(self, "cluster", conf)

		if "files_url" not in self._conf:
			raise MissingConfigParamError("files_url")

		url = urlparse(self._conf["files_url"])
		self._files_scheme = url.scheme
		self._files_host = url.netloc

		if self._files_scheme not in ["ssh", "file", "rsync"]:
			raise Exception("Unsupported scheme: {}".format(self._files_scheme))

		self._remote_path = self._conf.get("remote_path", self._work_path)
		self._projects_path = self._conf.get("projects_path", os.path.join(self._work_path, "projects"))

		self._rsync_path = self._conf.get("rsync_path", "rsync")
    def __init__(self):
        pygame.init()

        self.screen = Screen()
        self.clock = pygame.time.Clock()
        self.doodler = Doodler(Screen.WIDTH / 2, Screen.HEIGHT / 2)

        self.p1 = Platform(Screen.WIDTH / 2, Screen.HEIGHT / 2 + 130)
Beispiel #30
0
    def __init__(self, conf):
        Platform.__init__(self, "cluster", conf)

        if "files_url" not in self._conf:
            raise MissingConfigParamError("files_url")

        url = urlparse(self._conf["files_url"])
        self._files_scheme = url.scheme
        self._files_host = url.netloc

        if self._files_scheme not in ["ssh", "file", "rsync"]:
            raise Exception("Unsupported scheme: {}".format(
                self._files_scheme))

        self._remote_path = self._conf.get("remote_path", self._work_path)
        self._projects_path = self._conf.get(
            "projects_path", os.path.join(self._work_path, "projects"))

        self._rsync_path = self._conf.get("rsync_path", "rsync")
Beispiel #31
0
def init(p1_actions):
    platforms.empty()
    global player
    for i in range(height // 100):
        for j in range(width // 420):
            platform = Platform((random.randint(5, (width - 50) // 10) * 10,
                                 120 * j + random.randint(0, 4) * 100), 'images/platform.png', 70, 40)
            platforms.add(platform)
    player = Player((platforms.sprites()[-1].rect.centerx, platforms.sprites()[-1].rect.centery - 300), p1_actions)
    sprites.add(player)
Beispiel #32
0
 def __init__(self):
     # initialize pygame and create window
     pygame.init()
     self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
     pygame.display.set_caption("My Game")
     self.clock = pygame.time.Clock()
     self.running = True
     self.spritesheet = Spritesheet(
         os.path.join(img_folder, "p1_spritesheet.png"))
     self.ground = Platform(0, HEIGHT - 40, WIDTH, 40, self)
Beispiel #33
0
def frametest(display):

    # frames = (VolumeAmountFrame, TextFrame, MenuFrame, SourceIconFrame, VUFrame, SpectrumFrame)   # create a list of all screens to test one by one
    scaled_frames = (RecordingScreen)
    # frames = (VU2chFrame, VUV2chFrame, Spectrum2chFrame)
    limits = ((0.3,"white"), (0.6,"grey"), (0.8,"red"))
    events          = Events(( 'Platform', 'CtrlTurn', 'CtrlPress', 'VolKnob', 'Audio', 'RemotePress'))
    p = Platform(events)
    if display=='int':
        d = p.internaldisplay
    else:
        d = p.frontdisplay

    geo   = Geometry(d.boundary)
    geo.scale( (1.0, 1.0) )   # make the  Screen scale width
    # for f in scaled_frames:
    # f = VUV2chFrame
    # # a = f(geo.coords, p, d, 'left', limits )
    # a = f(geo.coords, p, d, 0.3 )

    # f = SpectrumFrame
    # a = f(geo.coords, p, d, 'left', 0.4 )
    # print( "%s initialised: %s" % (type(f).__name__, a) )
    # f = Spectrum2chFrame
    # a = f(geo.coords, p, d, 1.0 )
    # print( "%s initialised: %s" % (type(f).__name__, a) )

    # f = VUMeterAFrame
    # a = f(geo.coords, p, d, 'left', 0.5 )

    # a = testScreen1(p, d)
    # print( "%s initialised: %s" % (type(f).__name__, a) )

    # import math
    # a = MetersAScreen(p, d)
    # d.draw(a)
    # for _ in range(0, 10):
    #     for x in range(0,360,10):
    #
    #         p.vu['left'] = math.pow(math.sin(x),2)
    #         p.vu['right'] = math.pow(math.cos(x),2)
    #         print("x =",x, p.vu)
    #         d.draw(a)
    #         time.sleep(0.1)
    #
    # print( "Drawn: %s" % ( a) )
    # time.sleep(5)

    #
    #
    a = RecordingScreen(p, d)
    print( "RecordingScreen initialised: ", a, p )
    d.draw(a)
    time.sleep(5)
Beispiel #34
0
    def crete_platforms(self):
        ws_platform_static = [[80, 35, 0, 175], [40, 30, 80, 200],
                              [40, 30, 120, 220], [220, 15, 120, 220],
                              [275, 75, 370, 175], [115, 250, 640, 0],
                              [50, 40, 0, 500], [380, 40, 50, 540],
                              [350, 50, 430, 500], [180, 100, 750, 395],
                              [150, 50, 930, 430], [50, 50, 1080, 395]]

        for ws in ws_platform_static:
            platform_object = Platform(*ws)
            self.set_of_platforms.add(platform_object)
Beispiel #35
0
    def __init__(self):
        pygame.init()
        self.game_settings = Settings()

        self.screen = pygame.display.set_mode([
            self.game_settings.screen_width, self.game_settings.screen_height
        ])
        self.title = pygame.display.set_caption(self.game_settings.title)
        self.running = True

        ############
        #OBJ IN GAME
        ############
        #SINGLE OBJ
        self.game_bird = Bird(self)
        self.game_platform = Platform(self)

        #GROUP OBJ
        self.game_pipes = pygame.sprite.Group()
        self.create_pipes()
Beispiel #36
0
class Command(object):

    def __init__(self, *args, **kwargs):
        self.storage = DataStore()
        self.platform = Platform()

    def _app_string(self):
        return colored.cyan('Bam!')

    def all(self):
        lists = self.storage.get_all_lists()
        for list_name, values in lists.iteritems():
            with indent(INDENT):
                puts(list_name)
                for k, v in values.iteritems():
                    with indent(INDENT):
                        puts('{}:\t\t{}'.format(k, v))

    def overview(self):
        lists = self.storage.get_all_lists()
        if lists:
            for list_name, values in lists.iteritems():
                with indent(INDENT):
                    puts("{} ({})".format(list_name, len(values)))
        else:
            self.help()

    def create_list(self, list_name, item_name=None, item_value=None):
        self.storage.create_list(list_name)
        print '{} Created a new list called {}.'.format(
            self._app_string(),
            colored.yellow(list_name)
        )
        if item_name and item_value:
            self.add_item(list_name, item_name, item_value)

    def detail_list(self, list_name):
        if self.storage.list_exists(list_name):
            for k, v in self.storage.get_list(list_name).iteritems():
                with indent(INDENT_LARGE):
                    puts('{}:\t\t{}'.format(k, v))
        else:
            print 'Cannot find list "{}".'.format(list_name)

    def delete_list(self, list_name):
        answer = raw_input(
            "You sure you want to delete everything in {}? (y/n): ".format(
                colored.yellow(list_name))
            )
        if answer.strip().lower() == 'y':
            self.storage.delete_list(list_name)
            print "{} Deleted all your {}.".format(
                self._app_string(),
                colored.yellow(list_name)
            )
        else:
            print "Just kidding then."

    def add_item(self, list_name, name, value):
        self.storage.add_item(list_name, name, value)
        print '{} {} in {} is {}. Got it.'.format(
            self._app_string(),
            colored.yellow(name),
            colored.yellow(list_name),
            colored.yellow(value)
        )

    def search_list_for_item(self, list_name, name):
        value = self.storage.get_item(name, list_name=list_name)
        print "{} We just copied {} to your clipboard.".format(
            self._app_string(),
            colored.yellow(self.platform.copy(value))
        )


    def search_items(self, name):
        value = self.storage.get_item(name)
        
        print "We just copied {} to your clipboard.".format(
            colored.yellow(self.platform.copy(value))
        )

    def delete_item(self, list_name, name):
        if self.storage.list_exists(list_name):
            try:
                self.storage.delete_item(list_name, name)
                print "{} {} is gone forever.".format(
                    self._app_string(),
                    colored.yellow(name)
                )
            except KeyError:
                print "{} {} {}.".format(
                    colored.yellow(name),
                    colored.red("not found in"),
                    colored.yellow(list_name)
                )
        else:
            print "We cound't find that list."

    def echo(self, major, minor=None):
        list_name = list_name = None
        if minor:
            list_name, item_name = major, minor
        else:
            item_name = major
            
        output = self.storage.get_item(item_name, list_name=list_name)
        if not output:
            if list_name and item_name:
                output = "{} {} {}".format(
                    colored.yellow(item_name),
                    colored.red("not found in"),
                    colored.yellow(list_name)
                )
            else:
                output = "{} {}".format(
                    colored.yellow(item_name),
                    colored.red("not found")
                )
        print output

    def edit(self):
        print "{} {}".format(
            self._app_string(),
            self.platform.edit(self.storage.data_path)
        )

    def open(self, major, minor):
        noun = None
        if self.storage.list_exists(major):
            the_list = self.storage.get_list(major)

            if minor:
                value = self.storage.get_item(minor, list_name=major)
                if value:
                    self.platform.open(value)
                    output = "{} We just opened {} for you."
                    noun = value
            else:
                for value in the_list.values():
                    self.platform.open(value)
                output = "{} We just opened all of {} for you."
                noun = major
        else:
            value = self.storage.get_item(major)
            if value:
                self.platform.open(value)
                output = "{} We just opened {} for you."
                noun = value
                
        print output.format(
            self._app_string(),
            colored.yellow(noun)
        )

    def random(self, major):
        if major and self.storage.list_exists(major):
            values = self.storage.get_list(major).values()
        else:
            values = self.storage.get_values()
        print "{} We just opened {} for you.".format(
            self._app_string(),
            colored.yellow(self.platform.open(choice(values)))
        )

    def execute(self):
        args = clint.Args()
        command = args.get(0)
        major = args.get(1)
        minor = args.get(2)
        if not command:
            return self.overview()
        self.delegate(command, major, minor)

    def delegate(self, command, major, minor):
        if command == 'all':
            return self.all()
        elif command == 'help' or command[0] == '-':
            return self.help()
        elif command in ['echo', 'e']:
            return self.echo(major, minor)
        elif command == 'edit':
            return self.edit()
        elif command in ['open', 'o']:
            return self.open(major, minor)
        elif command in ['random', 'rand', 'r']:
            return self.random(major)

        if self.storage.list_exists(command):
            if major == DELETE_OPTION:
                return self.delete_list(command)
            if not major:
                return self.detail_list(command)
            if minor != DELETE_OPTION:
                if minor:
                    return self.add_item(command, major, minor)
                return self.search_list_for_item(command, major)

        if minor == DELETE_OPTION and self.storage.item_exists(major):
            return self.delete_item(command, major)

        if self.storage.item_exists(command) and not major:
            return self.search_items(command)

        return self.create_list(command, item_name=major, item_value=minor)

    def empty(self):
        text = """
            You don't have anything yet! To start out, create a new list:
              $ bam <list-name>
            And then add something to your list!
              $ bam <list-name> <item-name> <item-value>
            You can then grab your new item:
              $ bam <item-name>"""[1:]
        print textwrap.dedent(text)

    def help(self):
        text = """
            - bam: help ---------------------------------------------------

            bam                          display high-level overview
            bam all                      show all items in all lists
            bam edit                     edit the bam JSON file in $EDITOR
            bam help                     this help text

            bam <list>                   create a new list
            bam <list>                   show items for a list
            bam <list> --delete          deletes a list

            bam <list> <name> <value>    create a new list item
            bam <name>                   copy item's value to clipboard
            bam <list> <name>            copy item's value to clipboard
            bam open <name>              open item's url in browser
            bam open <list> <name>       open all item's url in browser for a list
            bam random                   open a random item's url in browser
            bam random <list>            open a random item's url for a list in browser
            bam echo <name>              echo the item's value without copying
            bam echo <list> <name>       echo the item's value without copying
            bam <list> <name> --delete   deletes an item
        """
        with indent(INDENT):
            puts(textwrap.dedent(text))
Beispiel #37
0
    def __init__(self,player):
 
        Level.__init__(self, player)
        self.obstacles = [
                     [800,20,20,SCREEN_HEIGHT-120],
                     [200,20,860,SCREEN_HEIGHT-120],
                     [SCREEN_WIDTH-380,20,400,SCREEN_HEIGHT-220],
                     [150,20,210,SCREEN_HEIGHT-220],
                     [700,20,20,SCREEN_HEIGHT-320],
                     [300,20,760,SCREEN_HEIGHT-320],
                     [SCREEN_WIDTH-380,20,400,SCREEN_HEIGHT-420],
                     [200,20,160,SCREEN_HEIGHT-420],
                     [500,20,20,SCREEN_HEIGHT-520],
                     [400,20,560,SCREEN_HEIGHT-520],
                     [SCREEN_WIDTH-330,20,350,SCREEN_HEIGHT-620],
                     [100,20,210,SCREEN_HEIGHT-620],
                     [750,20,20,SCREEN_HEIGHT-720],
                     [200,20,810,SCREEN_HEIGHT-720],
                     [SCREEN_WIDTH-380,20,400,SCREEN_HEIGHT-820],
                     [150,20,210,SCREEN_HEIGHT-820],
                     [100,20,600,SCREEN_HEIGHT-920],
                     [200,20,740,SCREEN_HEIGHT-920],
                 ]
        self.ladders  = [
                [820,SCREEN_HEIGHT-120,55,100],
                [350,SCREEN_HEIGHT-220,55,100],
                [710,SCREEN_HEIGHT-320,55,100],
                [350,SCREEN_HEIGHT-420,55,100],
                [515,SCREEN_HEIGHT-520,55,100],
                [305,SCREEN_HEIGHT-620,55,100],
                [755,SCREEN_HEIGHT-720,55,100],
                [355,SCREEN_HEIGHT-820,55,100],
                [695,SCREEN_HEIGHT-920,55,100],
                [800,SCREEN_HEIGHT-220,55,30],
                [800,SCREEN_HEIGHT-160,55,20],
                [800,SCREEN_HEIGHT-620,55,30],
                [800,SCREEN_HEIGHT-560,55,20]
                
                
            ]
        L = [self.level[0],self.level[2]]
        for platform in L:
            k = platform[3]
            for i in range(platform[1]/16):
                block = Platform()
                block.rect.x = platform[2]
                block.rect.y = k
                self.platform_list.add(block)
                k+=16
        
        __level = [self.level[1],self.level[3]]
        for i in self.obstacles:
            __level.append(i)
 
        for platform in __level:
            __k = platform[2]
            for i in range(platform[0]/16):
                block = Platform()
                block.rect.x = __k
                block.rect.y = platform[3]
                block.player = self.player
                self.platform_list.add(block)
                __k+=16

        for ladder in self.ladders:
            block = Ladders(ladder[2],ladder[3])
            block.rect.x = ladder[0]
            block.rect.y = ladder[1]
            self.ladder_list.add(block)
Beispiel #38
0
	def __init__(self, conf):
		Platform.__init__(self, "local", conf)
Beispiel #39
0
    def createSprite(self,lines, j, i, character):
        self.stageScale = 50
        
        # Para que player aparezca en esquina superior izquierda
        x = self.stageScale * (j)
        y = self.stageScale * (i)

        sprite = Platform()
        sprite.i = i
        sprite.j = j

        if character == "a":
            sprite.image = self.imageDictionary["topCement"]
            sprite.imagen2 = self.imageDictionary["topCement"]
        elif character == "t":
            sprite.image = self.imageDictionary["lowEarth"]
            sprite.imagen2 = self.imageDictionary["lowEarth"]
        elif character == "b":
            sprite.image = self.imageDictionary["water"]
            sprite.imagen2 = self.imageDictionary["watert"]
            sprite.color = "Blue"     
        elif character == "l":
            sprite.image = self.imageDictionary["lavat"]
            sprite.imagen2 = self.imageDictionary["lavat"]
        elif character == "s":
            sprite.image = self.imageDictionary["sand"]
            sprite.imagen2 = self.imageDictionary["sand"]
        elif character == "w":
            sprite.image = self.imageDictionary["watert"]
            sprite.imagen2 = self.imageDictionary["watert"]
        elif character == 'r':
            sprite.image = self.imageDictionary["lava"]
            sprite.imagen2 = self.imageDictionary["lava"]
            #sprite.color = "Green"
        elif character == "O":
             sprite.image = self.imageDictionary["water"]
             sprite.imagen2 = self.imageDictionary["watert"]
             sprite.color = "Blue" 
        elif character == "P":
            sprite.image = self.imageDictionary["lava"]
            sprite.imagen2 = self.imageDictionary["lavat"]
            sprite.color = "Green"
        elif character == "Q":
            sprite.image = self.imageDictionary["water"]
            sprite.imagen2 = self.imageDictionary["watert"]
            sprite.color = "Blue" 
        elif character == "F":
            sprite.image = self.imageDictionary["lava"]
            sprite.imagen2 = self.imageDictionary["lavat"]
            sprite.color = "Green"    

        else: 
            sprite.image = self.imageDictionary["lava"]
            sprite.imagen2 = self.imageDictionary["lavat"]
            sprite.color = "Green"

        if character == "P" or character == "O":
            colorlargo = self.createPlatform(lines,j,i,"H")
            color = colorlargo[0]
            scale_x = colorlargo[1]
            scale_y = colorlargo[2]
            sprite.color = color
            #scale = 2
            x = self.stageScale * (j)
            y = self.stageScale * (i)
            sprite.scale_x = scale_x
            sprite.scale_y = scale_y
            sprite.x_scale = self.stageScale *scale_x
            sprite.y_scale = self.stageScale*scale_y
            sprite.image = pygame.transform.scale(sprite.image, (int(scale_x*self.stageScale), int(scale_y*self.stageScale)))
            sprite.imagen2 = pygame.transform.scale(sprite.imagen2, (int(scale_x*self.stageScale), int(scale_y*self.stageScale)))
            sprite.rect = pygame.Rect((x, y), (scale_x*self.stageScale, scale_y*self.stageScale))
            sprite.imagenoriginal = sprite.image
        elif character == "F" or character == "Q":
            sprite.x_scale = self.stageScale 
            sprite.y_scale = self.stageScale
            sprite.image = pygame.transform.scale(sprite.image, (int(0.5*self.stageScale), 5*self.stageScale))
            sprite.imagen2 = pygame.transform.scale(sprite.imagen2, (int(0.5*self.stageScale), 5*self.stageScale))
            sprite.rect = pygame.Rect((x, y), (int(0.5*self.stageScale), 5*self.stageScale))
            sprite.imagenoriginal = sprite.image   
            if character == "F":
                sprite.color = "Green"
            elif character == "Q":
                sprite.color = "Blue"
        else:
            sprite.x_scale = self.stageScale 
            sprite.y_scale = self.stageScale
            sprite.image = pygame.transform.scale(sprite.image, (self.stageScale, self.stageScale))
            sprite.imagen2 = pygame.transform.scale(sprite.imagen2, (self.stageScale, self.stageScale))
            sprite.rect = pygame.Rect((x, y), (self.stageScale, self.stageScale))
            sprite.imagenoriginal = sprite.image

        # Define rectangulos que serviran para delimitar etapa y limitar movimiento de la camara
        if i == 0 and j == 0:
            self.firstRect = pygame.Rect((x, y), (self.stageScale, self.stageScale))
        elif i == (self.height - 1) and j == (self.width - 1):
            self.lastRect = pygame.Rect((x, y), (self.stageScale, self.stageScale))
        sprite.colororiginal = sprite.color
        self.group.add(sprite); 
Beispiel #40
0
    def __init__(self, numchannels, numantpol, accumulation_length, skybandwidth, input_bitwidth, fft_out_bitwidth):
        self.blocks = {}
        self.totalblocks = 0
        self.maxdesigns = 1
        self.singleimplementation = 1
        self.windowsize = 1024
        cost = 'dollars'
        #cost = 'power'
        
        #add the platforms
        self.platforms = {}
        #self.platforms['GTX580'] = Platform.createGTX580Server(cost)
        #self.platforms['ROACH'] = Platform.createRoach(cost)
        self.platforms['DualGTX690'] = Platform.createDualGTX690Server(cost)
        self.platforms['ROACH2'] = Platform.createRoach2(cost)
        
        
        # add the ADC
        adc_bw = skybandwidth*2*input_bitwidth
        #self.blocks['ADC'] = CBlock('ADC',CBlock.getADCModel(self.platforms, skybandwidth, input_bitwidth),-1,0,0,'FIR',0,4*adc_bw,numantpol/4)
        # we are using a 16 input adc board
        # multiplier needs to be a multiple of 4 because the benchmarks do 4 parallel firs and ffts
        adcmultiplier = 4   # process 4 streams at a time
        self.blocks['ADC'] = CBlock('ADC',CBlock.getADCModel(self.platforms, skybandwidth, input_bitwidth), -1,0,0,'PFB',0,adcmultiplier*adc_bw,numantpol/adcmultiplier, CBlock.getADCMaximums(self.platforms, adcmultiplier))
        self.totalblocks += numantpol/adcmultiplier
        

        #use pfb to process 4 channels at a time
        fft_out_bandwidth = skybandwidth * 2 * fft_out_bitwidth
        pfb_model = CBlock.getPFBModel(self.platforms, skybandwidth, input_bitwidth, numchannels)
        fft_model = CBlock.getFFTRealModel(self.platforms, skybandwidth, numchannels)
        firfftmodel = CBlock.combineModels(pfb_model, fft_model)
        #print firfftmodel
        #firfft2xmodel = CBlock.combineModels(firfftmodel, firfftmodel)
        #print firfft2xmodel
        self.blocks['PFB'] = CBlock('PFB',firfftmodel,'ADC',0,adcmultiplier*adc_bw,'Transpose',0,adcmultiplier*fft_out_bandwidth,numantpol/adcmultiplier)
        self.totalblocks += numantpol/adcmultiplier
        
        transposemodel = CBlock.getTransposeModel(self.platforms, skybandwidth, numchannels, self.windowsize)
        self.blocks['Transpose'] = CBlock('Transpose',transposemodel,'PFB',0,adcmultiplier*fft_out_bandwidth,'XEng',0,adcmultiplier*fft_out_bandwidth,numantpol/adcmultiplier)
        self.totalblocks += numantpol/adcmultiplier

        
        # add the PFBTranspose
        #fft_out_bandwidth = skybandwidth * 2 * fft_out_bitwidth
        #firmodel = CBlock.getPFBModel(self.platforms, skybandwidth, input_bitwidth, numchannels)
        #fftmodel = CBlock.getFFTRealModel(self.platforms, skybandwidth, numchannels)
        #transposemodel = CBlock.getTransposeModel(self.platforms, skybandwidth, numchannels, self.windowsize)
        #combinedmodel = CBlock.combineModels(firmodel, CBlock.combineModels(fftmodel, transposemodel))
        #we need 4 of these for our 16 input adc
        #self.blocks['PFBTranspose'] = CBlock('PFBTranspose',combinedmodel,'ADC',0,adcmultiplier*adc_bw,'XEng',1,adcmultiplier * fft_out_bandwidth,numantpol/adcmultiplier)
        #self.totalblocks += numantpol/adcmultiplier
        
        
        
        # add the XEngines
        gtx580_max_bw = {32:0.06914, 64:0.03095, 96:0.01748, 128:0.01069, 192:0.00536, 256:0.00318, 512:0.00087, 1024:0.00023}
        # the minimum number of xengines we need
        # if we use any fewer, they will not fit on the gpu
        mingpuxengines = int(numpy.power(2,numpy.ceil(numpy.log2(skybandwidth/gtx580_max_bw[numantpol]))))
        
        # assume xengine is running at 200MHz, takes nantpol clock cycles to get the data out for a single frequency channel
        # maximum bandwidth it can process is 200MHz/nantpol
        maxfpgaxengbw = .2/numantpol
        
        #the maximum amount of bandwidth we can process in an xengine and still support our platforms
        maxxenginebw = min(maxfpgaxengbw,gtx580_max_bw[numantpol])
        
        # we need to create this many xengines to meet the spec
        minxengines = int(skybandwidth/maxxenginebw)
        
        #note: this needs to be a power of 2
        numxengines = 8*minxengines
        
        #numxengines = 4*mingpuxengines
        #print 'Num xengines is: ' + `numxengines`
        #numxengines = mingpuxengines*4
        xengine_sky_bandwidth = skybandwidth/numxengines
        #print 'Sky bw is: ' + `xengine_sky_bandwidth`
        #print xengine_sky_bandwidth
        xengine_in_bandwidth = numantpol*fft_out_bandwidth/numxengines
        #print CBlock.getXEngModel(self.platforms, xengine_sky_bandwidth, numantpol)
        self.blocks['XEng'] = CBlock('XEng',CBlock.getXEngModel(self.platforms, xengine_sky_bandwidth, numantpol) ,'Transpose', 1,xengine_in_bandwidth,-1,0,0,numxengines)
        self.totalblocks += numxengines
Beispiel #41
0
 def __init__(self, *args, **kwargs):
     self.storage = DataStore()
     self.platform = Platform()
Beispiel #42
0
def main():

    screen = display.set_mode(WIN_SIZE)
    display.set_caption('ARCANOID')

    bg = Surface(WIN_SIZE)
    bg.fill((100,100,200))

    win = image.load('Spr/win.png')

    boll = Boll(500, 300)
    pl = Platform(500, 500)

    bricks = [
        [0, 1, 2, 3, 0, 1, 2, 3, 0, 1],
        [1, 2, 3, 0, 1, 2, 3, 0, 1, 2],
        [2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
        [3, 0, 1, 2, 3, 0, 1, 2, 3, 0],
        [0, 1, 2, 3, 0, 1, 2, 3, 0, 1],
        [1, 2, 3, 0, 1, 2, 3, 0, 1, 2],
        [2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
        [3, 0, 1, 2, 3, 0, 1, 2, 3, 0],
        [0, 1, 2, 3, 0, 1, 2, 3, 0, 1],
        [1, 2, 3, 0, 1, 2, 3, 0, 1, 2],
    ]

    left = right = reboot =False

    timer = pygame.time.Clock()

    count = True
    while count:
        timer.tick(60)
        for e in event.get():
            if e.type == QUIT:
                count = False

            if e.type == KEYDOWN and e.key == K_LEFT:
                left = True
            if e.type == KEYDOWN and e.key == K_RIGHT:
                right = True

            if e.type == KEYUP and e.key == K_LEFT:
                left = False
            if e.type == KEYUP and e.key == K_RIGHT:
                right = False

            if e.type == KEYDOWN and e.key == K_r:
                reboot = True
                bricks = [
                    [0, 1, 2, 3, 0, 1, 2, 3, 0, 1],
                    [1, 2, 3, 0, 1, 2, 3, 0, 1, 2],
                    [2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
                    [3, 0, 1, 2, 3, 0, 1, 2, 3, 0],
                    [0, 1, 2, 3, 0, 1, 2, 3, 0, 1],
                    [1, 2, 3, 0, 1, 2, 3, 0, 1, 2],
                    [2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
                    [3, 0, 1, 2, 3, 0, 1, 2, 3, 0],
                    [0, 1, 2, 3, 0, 1, 2, 3, 0, 1],
                    [1, 2, 3, 0, 1, 2, 3, 0, 1, 2],
                ]


            if e.type == KEYUP and e.key == K_r:
                reboot = False

        screen.blit(bg, (0, 0))

        win_count = 0
        x = y = 0
        for row in bricks:
            for col in row:
                if col != 4:
                    br = Brick(x+BOLL_D, y+BOLL_D, col)
                    br.draw(screen)
                    win_count = 1
                x += BRICK_WIDTH
            y += BRICK_HEIGHT
            x = 0

        boll.update(bricks, pl, reboot)
        if not win_count:
            boll.dx = 0
            boll.dy = 0
        boll.draw(screen)

        if not win_count:
            screen.blit(win, (0, 0))

        pl.update(left, right, reboot)
        pl.draw(screen)

        display.update()
Beispiel #43
0
    def CheckCollision(self, player, group, x1, y1):

        newPos = pygame.Rect(x1, y1, player.sprite.rect.width, player.sprite.rect.height)
        playerMoved = pygame.sprite.Sprite()
        playerMoved.rect = newPos

        spriteListaux = pygame.sprite.spritecollide(playerMoved, group, False)
        self.spriteList = spriteListaux

        if len(spriteListaux) >= 1:
            for sprite in spriteListaux:
                if sprite.color == player.color or sprite.color == "Todos" or sprite.activada :
                    rect = sprite.rect
                    self.topY = rect.top
                    self.bottomY = rect.top + rect.height
                    self.rightX = rect.left + rect.width
                    self.leftX = rect.left
                    if sprite.color == player.color:
                        sprite.activada = True
                    player.colisionada = sprite
                    return True
                elif sprite.activada == False and sprite.tipo =="Color":
                    companeroPos = pygame.Rect(player.companero.X, player.companero.Y+1, player.companero.sprite.rect.width, player.companero.sprite.rect.height)
                    companeroMoved = Platform()
                    companeroMoved.color = player.companero.color
                    companeroMoved.rect = companeroPos
                    if companeroMoved.color == sprite.color and pygame.sprite.collide_rect(sprite,companeroMoved):
                        rect = sprite.rect
                        self.topY = rect.top
                        self.bottomY = rect.top + rect.height
                        self.rightX = rect.left + rect.width
                        self.leftX = rect.left                       
                        sprite.activada = True
                        player.colisionada = sprite
                        return True
                    else:
                     sprite.activada = False
                    companeroPos = pygame.Rect(player.companero.X+1, player.companero.Y, player.companero.sprite.rect.width, player.companero.sprite.rect.height)
                    companeroMoved = Platform()
                    companeroMoved.color = player.companero.color
                    companeroMoved.rect = companeroPos
                    if companeroMoved.color == sprite.color and pygame.sprite.collide_rect(sprite,companeroMoved):
                        rect = sprite.rect
                        self.topY = rect.top
                        self.bottomY = rect.top + rect.height
                        self.rightX = rect.left + rect.width
                        self.leftX = rect.left                       
                        sprite.activada = True
                        player.colisionada = sprite
                        return True
                    else:
                      sprite.activada = False
                    companeroPos = pygame.Rect(player.companero.X-1, player.companero.Y+1, player.companero.sprite.rect.width, player.companero.sprite.rect.height)
                    companeroMoved = Platform()
                    companeroMoved.color = player.companero.color
                    companeroMoved.rect = companeroPos
                    if companeroMoved.color == sprite.color and pygame.sprite.collide_rect(sprite,companeroMoved):
                        rect = sprite.rect
                        self.topY = rect.top
                        self.bottomY = rect.top + rect.height
                        self.rightX = rect.left + rect.width
                        self.leftX = rect.left                       
                        sprite.activada = True
                        player.colisionada = sprite
                        return True
                    else:
                     sprite.activada = False
            sprite.activada = False       
            return False
        else:
            
            return False