예제 #1
0
    def __init__(self, setting: settings, shoot_sound):
        self.shoot_sound = shoot_sound
        self.fleet = list()
        self.move_speed = setting.alien_speed
        self.creep_speed = setting.creep_speed
        self.gun = Gun(setting)
        self.setting = setting
        self.saucer = Saucer(setting, Vector2(-64, 64 * 2))

        for i in range(10):
            self.fleet.append(Squid(setting, pygame.Vector2(70 * i, 70)))
        for i in range(10):
            self.fleet.append(Squid(setting, pygame.Vector2(70 * i, 70 * 2)))
        for i in range(10):
            self.fleet.append(Jelly(setting, pygame.Vector2(70 * i, 70 * 3)))
        for i in range(10):
            self.fleet.append(Jelly(setting, pygame.Vector2(70 * i, 70 * 4)))
        for i in range(10):
            self.fleet.append(Crab(setting, pygame.Vector2(70 * i, 70 * 5)))
        for i in range(10):
            self.fleet.append(Crab(setting, pygame.Vector2(70 * i, 70 * 6)))
예제 #2
0
def crabActionCRAB251(options, action=None):

    options = parseOptions(options)

    result = None
    try:
        crab = Crab(options)
        crab.run()
        common.apmon.free()
        if action: result = action(crab)
        del crab
        #print 'Log file is %s%s.log'%(common.work_space.logDir(),common.prog_name)
        #print '\n##############################  E N D  ####################################\n'
    except CrabException, e:
        print '\n' + common.prog_name + ': ' + str(e) + '\n'
        pass
예제 #3
0
파일: crabWrap.py 프로젝트: setesami/CTPPS
def crabAction(options, action = None):

    options = parseOptions(options)

    crab = Crab()
    result = None
    try:
        crab.initialize_(options)
        crab.run()
        if action: result = action(crab)
        del crab
        print 'Log file is %s%s.log'%(common.work_space.logDir(),common.prog_name) 
    except CrabException, e:
        del crab
        #print '\n' + common.prog_name + ': ' + str(e) + '\n' 
        raise
예제 #4
0
 def gen_sprites(self):
     self.sprite_models.append(
         Crab(
             self.setting,
             Vector2(self.screen_dim.x / 2 - 128,
                     self.screen_dim.y / 10 * 3)))
     self.sprite_models.append(
         Jelly(
             self.setting,
             Vector2(self.screen_dim.x / 2 - 128,
                     self.screen_dim.y / 10 * 4)))
     self.sprite_models.append(
         Squid(
             self.setting,
             Vector2(self.screen_dim.x / 2 - 128,
                     self.screen_dim.y / 10 * 5)))
     self.sprite_models.append(
         Saucer(
             self.setting,
             Vector2(self.screen_dim.x / 2 - 128,
                     self.screen_dim.y / 10 * 6)))
예제 #5
0
    def saveButtonClicked(self):
        # TODO later figure out how this will talk to Chloe's algorithm and update these values
        if self.sex_drop_down.currentIndex() == 0 or self.species_drop_down.currentIndex() == 0 or self.color_drop_down.currentIndex() == 0 or\
           self.damage_drop_down.currentIndex() == 0 or self.epibiont_drop_down.currentIndex() == 0 or self.molt_drop_down.currentIndex() == 0:
            msg = QtGui.QMessageBox()
            msg.setIcon(QtGui.QMessageBox.Information)
            msg.setText("All dropdowns must have a valid selection!")
            msg.setWindowTitle("Dropdowns Invalid")
            msg.setStandardButtons(QtGui.QMessageBox.Ok)

            retval = msg.exec_()
        else:
            new_crab = Crab(self.uid_text_field.text(),
                            self.sex_drop_down.currentText(),
                            self.species_drop_down.currentText(),
                            self.color_drop_down.currentText(),
                            self.damage_drop_down.currentText(),
                            float(self.carapace_width_field.text()),
                            float(self.mass_field.text()),
                            self.epibiont_drop_down.currentText(),
                            self.molt_drop_down.currentText())
            insert_crab(new_crab)
            self.close()
예제 #6
0
    def __init__(self):
        self.running = True
        self.start = time.time()
        self.score = 0

        self.screen = pygame.display.set_mode(
            (IMAGE_WIDTH * ROW_LENGTH, IMAGE_HEIGHT * ROW_LENGTH))
        self.background = Player(
            str(Path("./data/images/beach.jpg")),
            (IMAGE_WIDTH * ROW_LENGTH, IMAGE_HEIGHT * ROW_LENGTH))
        self.player = Crab(
            str(
                Path(
                    "./data/images/crab_images/Crab Standing Animation/crab_standing_still0.png"
                )), (35, 35), (280, 300))

        self.pebbles = []
        self.jellyfish = []
        self.squids = []
        self.stalkers = []
        self.inks = []
        self.littlefish = []
        self.vignette = None

        self.end_screen = Player(str(Path("./data/images/endgame.png")),
                                 (700, 450), (-70, 0))
        # self.gulls = [Seagull(str(Path("./data/images/seagull.png")), (72, 44), self.background),
        #               Seagull(str(Path("./data/images/seagull.png")), (72, 44), self.background),
        #               Seagull(str(Path("./data/images/seagull.png")), (72, 44), self.background)]
        self.h_bars = [
            Player(str(Path("./data/images/health0.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health1.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health2.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health3.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health4.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health5.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health6.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health7.png")), (216, 134),
                   (10, -30)),
            Player(str(Path("./data/images/health8.png")), (216, 134),
                   (10, -30))
        ]

        self.moves = {
            "up": (0, -self.player.speed),
            "left": (-self.player.speed, 0),
            "down": (0, self.player.speed),
            "right": (self.player.speed, 0)
        }
        self._moves = self.moves.copy()

        pygame.init()
        pygame.display.init()
        pygame.font.init()

        self.score_font = pygame.font.Font('freesansbold.ttf', 30)
        self.symptom_font = pygame.font.Font('freesansbold.ttf', 15)

        pygame.mixer.init()
        pygame.mixer.music.set_volume(0.7)
        pygame.mixer.music.load("./data/music/Passport.mp3")
        pygame.mixer.music.play(-1)