def __init__(self, WINDOW, CLOCK, FPS=30, GROUPS=[]): super().__init__(WINDOW, CLOCK, FPS=30, GROUPS=[]) self.score = 0 self.game_font = pg.font.Font('./assets/NotoSans-BoldItalic.ttf', 24) self.group_buildings = pg.sprite.Group() self.group_buildings.add( BCGMask(self, './assets/bcg_edu.png', 'Education Building')) self.group_buildings.add( BCGMask(self, './assets/bcg_library.png', 'Library')) self.group_enemy = pg.sprite.Group() # 적 그룹! self.group_enemybullets = pg.sprite.Group() # 적 총알 그룹! self.group_playerbullets = pg.sprite.Group() # 총알 그룹! self.group_player = pg.sprite.Group() self.group_overlay = pg.sprite.Group() self.background = Background(self) self.group_background = pg.sprite.Group() self.group_background.add(self.background) self.group_flag = pg.sprite.Group() self.groups.append(self.group_buildings) self.groups.append(self.group_background) self.groups.append(self.group_enemy) self.groups.append(self.group_enemybullets) self.groups.append(self.group_playerbullets) self.groups.append(self.group_player) self.groups.append(self.group_flag) self.groups.append(self.group_overlay) self.player = prefabs.Player(self, 180, 240) bar_image = pg.image.load('./assets/bar.png') bar2_image = pg.image.load('./assets/bar2.png') overlay_image = pg.image.load('./assets/overlay.png') overlay2_image = pg.image.load('./assets/overlay2.png') edge_image = pg.image.load('./assets/bar_edge.png') edge2_image = pg.image.load('./assets/bar2_edge.png') animation_image = [] animation_image.append(pg.image.load('./assets/bar_anim_1.png')) animation_image.append(pg.image.load('./assets/bar_anim_2.png')) animation_image.append(pg.image.load('./assets/bar_anim_3.png')) bar_rect = bar_image.get_rect() bar_rect.x = 52 bar_rect.y = 16 self.bar_health = Bar(self, bar_rect, bar_image, edge_image, overlay_image, animation_image, [40, 80, -30], 1000) bar2_rect = bar2_image.get_rect() bar2_rect.x = 52 bar2_rect.y = 64 self.bar_time = Bar(self, bar2_rect, bar2_image, edge2_image, overlay2_image, animation_image, [40, 80, -30], 60000) self.group_overlay.add(self.bar_health) self.group_overlay.add(self.bar_time) self.group_player.add(self.player) self.enemy_timer = pg.time.get_ticks() self.finish_timer = pg.time.get_ticks() self.death_time = -1 self.spawn_enemy()
def __init__(self, WINDOW, CLOCK, FPS=30, GROUPS=[]): super().__init__(WINDOW, CLOCK, FPS=30, GROUPS=[]) self.score = 0 self.game_font = pg.font.Font('./assets/NotoSans-BoldItalic.ttf', 24) self.edgemask = BCGMask(self, './assets/edgemask.png', 'Edge') self.group_bcgmask = pg.sprite.Group() self.group_bcgmask.add(self.edgemask) self.group_buildings = pg.sprite.Group() self.group_buildings.add( BCGMask(self, './assets/bcg_edu.png', 'Education Building')) self.group_buildings.add( BCGMask(self, './assets/bcg_library.png', 'Library')) self.group_buildings.add( BCGMask(self, './assets/bcg_historic.png', 'Hanyang History Building')) self.group_buildings.add( BCGMask(self, './assets/bcg_dorm1.png', 'Dorm1')) self.group_buildings.add( BCGMask(self, './assets/bcg_lion.png', 'Lion Statue')) #self.group_buildings.add(BCGMask(self,'./assets/bcg_mainbdg.png','Main Building')) self.group_buildings.add( BCGMask(self, './assets/bcg_itbt.png', 'IT/BT')) ''' self.group_buildings.add(BCGMask(self,'./assets/bcg_engi1.png','Engineering Building 1')) self.group_buildings.add(BCGMask(self,'./assets/bcg_engi2.png','Engineering Building 2')) self.group_buildings.add(BCGMask(self,'./assets/bcg_business.png','HIT')) self.group_buildings.add(BCGMask(self,'./assets/bcg_nature.png','Nature')) self.group_buildings.add(BCGMask(self,'./assets/bcg_paiknammusic.png','Music')) self.group_buildings.add(BCGMask(self,'./assets/bcg_music2.png','Music2')) self.group_buildings.add(BCGMask(self,'./assets/bcg_plaza.png','Plaza')) ''' self.group_buildings.add(BCGMask(self, './assets/bcg_rotc.png', 'Rotc')) self.group_buildings.add(BCGMask(self, './assets/bcg_lit.png', 'Lit')) #self.group_buildings.add(BCGMask(self,'./assets/bcg_metrogate.png','Metro')) self.group_buildings.add( BCGMask(self, './assets/bcg_chungmongkoo.png', 'CMG')) #self.group_buildings.add(BCGMask(self,'./assets/bcg_intl.png','Intl')) self.group_buildings.add(BCGMask(self, './assets/bcg_edu2.png', 'Edu2')) self.group_buildings.add( BCGMask(self, './assets/bcg_theater.png', 'Theater')) self.group_buildings.add( BCGMask(self, './assets/bcg_livsci.png', 'Liv')) self.group_buildings.add( BCGMask(self, './assets/bcg_colosseum.png', 'Colo')) self.group_enemy = pg.sprite.Group() # 적 그룹! self.group_enemybullets = pg.sprite.Group() # 적 총알 그룹! self.group_playerbullets = pg.sprite.Group() # 총알 그룹! self.group_player = pg.sprite.Group() self.group_overlay = pg.sprite.Group() self.background = Background(self) self.group_background = pg.sprite.Group() self.group_background.add(self.background) self.group_flag = pg.sprite.Group() self.groups.append(self.group_buildings) self.groups.append(self.group_bcgmask) self.groups.append(self.group_background) self.groups.append(self.group_enemy) self.groups.append(self.group_enemybullets) self.groups.append(self.group_playerbullets) self.groups.append(self.group_player) self.groups.append(self.group_flag) self.groups.append(self.group_overlay) self.player = prefabs.Player(self, 180, 240) bar_image = pg.image.load('./assets/bar.png') bar2_image = pg.image.load('./assets/bar2.png') overlay_image = pg.image.load('./assets/overlay.png') overlay2_image = pg.image.load('./assets/overlay2.png') edge_image = pg.image.load('./assets/bar_edge.png') edge2_image = pg.image.load('./assets/bar2_edge.png') animation_image = [] animation_image.append(pg.image.load('./assets/bar_anim_1.png')) animation_image.append(pg.image.load('./assets/bar_anim_2.png')) animation_image.append(pg.image.load('./assets/bar_anim_3.png')) bar_rect = bar_image.get_rect() bar_rect.x = 52 bar_rect.y = 16 self.bar_health = Bar(self, bar_rect, bar_image, edge_image, overlay_image, animation_image, [40, 80, -30], 1000) bar2_rect = bar2_image.get_rect() bar2_rect.x = 52 bar2_rect.y = 64 self.bar_time = Bar(self, bar2_rect, bar2_image, edge2_image, overlay2_image, animation_image, [40, 80, -30], 60000) self.group_overlay.add(self.bar_health) self.group_overlay.add(self.bar_time) self.group_player.add(self.player) self.enemy_timer = pg.time.get_ticks() self.finish_timer = pg.time.get_ticks() self.death_time = -1 self.spawn_enemy() pg.mixer.music.load('./assets/sound/HYU_schoolsong_mr_16bit.wav') pg.mixer.music.play(-1)