def reset(self): self.background = background.StarryBackground(self.resolution) self.physics = Physics(self) self.cannon = MissileLauncher(centre=(self.resolution[0] / 2, self.resolution[1] - 99), game=self) self.buildings = Buildings(generate_city(self.resolution), self.resolution) self.firing = False self.fire_cycle = 0 self.shield_dome = ShieldDome(self.resolution) self.shield_dome.health = 2 self.missile_threshold = 0.01 self.projectiles = [] self.initial_buildings_sum = self.get_buildings_sum() self.buildings_sum = self.initial_buildings_sum self.score = 0
self.mapdata[y] = [0] * 128 for x in range(0, 128): self.mapdata[y][x] = int(self.mapstring[idx], 16) idx += 1 B = Biomes() BLOBS = Blobs() CONFIG = Configuration(B, BLOBS) P = Player(Vec2(82, 16).mul(32)) CAM = Camera(P.pos.sub(Vec2(64, 64 + 128))) CLOUDS = Clouds() TREES = Trees(CONFIG) BUSHES = Bushes(CONFIG) BUILDINGS = Buildings(CONFIG) M = MapFormat(CreateRandomWorld()) P.pos.y -= 128 CELLS = Cells(flr(CAM.pos.x / CELL_SIZE), flr(CAM.pos.y / CELL_SIZE), M.mapdata, CONFIG) def _init(): print("CAMERA", CAM.pos.x, CAM.pos.y) palt(0, False) palt(14, True) def _update():
forest_img = pygame.image.load('forest.png') opportunity_img = pygame.image.load('opportunity.png') pond_img = pygame.image.load('pond.png') help_img = pygame.image.load('help.png') dancefloor_img = pygame.image.load('dance_floor.png') store_img = pygame.image.load('store.png') adult_img = char_fr # object declarations player_1 = Adult("Katie", char_fr, char_bk, char_r, char_l) life_1 = Life() score_tracker = Scores_Button(screen) life_tracker = Life_Scores_Button(screen) counter = Question_Counter(screen) background = Background(screen, 'map_lg.png') cafe = Buildings("Cafe", -644, -1136, -856, -1232) bank = Buildings("Bank", -164, -464, -380, -638) travel_agency = Buildings("Travel Agency", -284, -200, -422, -368) forest = Spaces("Forest", -1010, -32, -1742, -452) opportunity = Buildings("Opportunities", -194, -1094, -272, -1238) pond = Spaces("Pond", -1334, -1010, -1502, -1208) selfhelp = Buildings("Help!", -290, -770, -440, -1052) store = Buildings("Store", -1340, -500, -1562, -626) dancefloor = Spaces("Dance Floor", -1316, -758, -1532, -872) central_lake = Spaces("Central Lake", -746, -566, -1028, -812) # Final Screen final_screen = Final_Score_Screen(screen) # ====================MAIN GAME LOOP===================== # game_on = True
def change2buildings(self): self.buildings = Buildings(root=self.f_screen, village=self.village, resources=self.resources, row_i=3, column_i=1)
def build(self, id): Buildings(self.browser).build_structure(id)
def overview(self): print(General(self.browser).get_resources()) print(Buildings(self.browser).get_buildings_data())