def rendershadow(self, screen): px, py = camera.screenpos(self.x, self.y, terrain.height(self.x, self.y)) pygame.draw.ellipse(screen, (20, 20, 20, 100), (px - 4, py - 2, 8, 4))
def render(self, screen): p0 = camera.screenpos(self.x, self.y, self.z) p1 = camera.screenpos(self.x + self.vx, self.y + self.vy, self.z) pygame.draw.line(screen, (255, 128, 0), p0, p1)
def render(self, screen): p0 = camera.screenpos(self.x, self.y, self.z) p1 = camera.screenpos(self.x+self.vx, self.y+self.vy, self.z) pygame.draw.line(screen, (255,128,0), p0, p1)
def render(self, screen): self.last_width = screen.get_width() cx = self.player.x cy = self.player.y cz = self.player.z camera.track(cx, cy, cz) structures = self.potato.get_structures_for_screen(cx, cy) labels = [] if self.curiosity != None: cur = self.curiosity for s in structures: if s.btype == 'hq' and s.user_id == self.user_id: cur.hq.x = s.x cur.hq.y = s.y entities = [cur.hq] height = cur.get_hq_height() if height != None: cur.hq.setheight(height) else: entities = [] else: for s in structures: if s.btype == 'hq': owner_id = s.user_id name = self.potato.get_user_name(owner_id) img = get_text(name, (255, 255, 255), 18) px, py = camera.screenpos(s.x, s.y, s.z - 20) labels.append([img, px-img.get_width()//2, py]) # Don't show destroyed buildings outside battle if self.battle is None: structures = [s for s in structures if not s.destroyed] entities = structures + self.shots # HACK entities += [s for s in self.sprites if (s.x - self.player.x) ** 2 + (s.y - self.player.y) ** 2 < 40 ** 2] # entities = structures + [self.player] + self.shots if self.battle != None: entities += self.battle.get_sprites() px, py = self.player.getModelXY() sx = int(px // 60) sy = int(py // 60) borders = self.potato.get_borders_near_sector(sx, sy) if self.potato.borders_by_user[self.user_id].iswithin(self.player.x, self.player.y): if self.build_mode: # HAAAAACK! s = structure.btypedict[self.build_mode].size if self.build_mode in structure.btypedict else 1 cursor = (cx, cy, s) else: cursor = (cx, cy, 0) else: cursor = None worldmap.drawscene(screen, entities + effects.effects, cursor, borders) if self.curiosity != None: self.curiosity.render_skycrane(screen) for label in labels: screen.blit(label[0], (label[1], label[2])) if settings.showminimap: worldmap.drawminimap(screen, entities) mx, my = self.player.getModelXY() lx, ly = int(mx // 1), int(my // 1) # coords = get_text("R: (%0.1f, %0.1f) M: (%0.1f, %0.1f) L: (%i, %i)" % (cx, cy, mx, my, lx, ly), (255, 255, 0), 16) coords = get_text("location: (%.0f, %.0f)" % (cx, cy), (255, 255, 0), 16) screen.blit(coords, (5, screen.get_height() - 25 - coords.get_height())) self.toolbar.render(screen) self.player.drawhealth(screen) if self.battle != None: self.battle.renderstatus(screen) left = 330 top = 40 y = top x = left for res in ('food', 'water', 'aluminum', 'copper', 'silicon', 'oil', 'research'): screen.blit(get_resource_icon(res), (left, y)) color = (255, 255, 255) if res == 'research': amount = int(self.potato.bytes_stolen) color = (0, 255, 255) else: amount = int(self.potato.get_resource(res)) if amount < 0: amount = 0 famount = [] while amount > 0: z = str(amount % 1000) while len(z) < 3: z = '0' + z famount.append(z) amount = amount // 1000 amount = ','.join(famount[::-1]) while len(amount) > 1 and amount[0] == '0': amount = amount[1:] screen.blit(get_text(str(amount), color, 14), (left + 14, y)) mx, my = self.mousex, self.mousey if mx > left and my > y and my < y + 20: newname = { 'food': settings.RESOURCE_FOOD, 'water': settings.RESOURCE_WATER, 'oil': settings.RESOURCE_OIL, 'aluminum': settings.RESOURCE_ALUMINUM, 'copper': settings.RESOURCE_COPPER, 'silicon': settings.RESOURCE_SILICON, 'research': "Bytes of Research" } img = get_text(newname[res], color, 14) screen.blit(img, (left - 5 - img.get_width(), y + 1)) y += 20 if self.blinkt: h = screen.get_height() w = screen.get_width() sh = min(h * self.blinkt // 10, h // 2 + 1) pygame.draw.rect(screen, (0,0,0), (0,0,w,sh), 0) pygame.draw.rect(screen, (0,0,0), (0,h-sh,w,sh), 0) jukebox.ensure_playing('general')