def __init__(self): w = config.grid_offset * config.map_size[0] + config.road_size * 2 h = config.grid_offset * config.map_size[1] + config.road_size * 2 Drawable.__init__(self, w, h) Eventable.__init__(self) self.dirty = 2 self.updates = False self.child_updates = False self.hud_mode = HUD_MODE.build self.last_playback_mode = None self.playback_mode = PLAYBACK_MODE.pause self.build_mode = BUILD_MODE.residential self.incident_spawn_timer = None self.incident_spawn_timeout_length = 10 self.incident_generator = IncidentGenerator() self.vp = None self.children = [] self.incidents = [] self.watchers = { "hud_mode_change": [], "playback_mode_change": [], "build_mode_change": [] }
def __init__(self, layer="Character"): Drawable.__init__(self, layer) Updatable.__init__(self) self.rect = pygame.Rect(0, 0, 64, 64) self.sprites = {0: loadImage("no_image.bmp")} #TODO Rename this. >.-.<
def __init__(self, graph = nx.Graph()): Drawable.__init__(self) Named.__init__(self) self.style().set_target_type('fill') self.add_name('_line_') self.__graph = graph self.__generate_paths() return
def __init__(self, text="", position=(0, 0)): Drawable.__init__(self) Translatable.__init__(self, position) Named.__init__(self) self.__text = text self.__font_size = 1 self.__scaled_direction = Vector(1, 0) return
def __init__(self, graph=nx.Graph(), options=[]): Drawable.__init__(self, options) Named.__init__(self) self.style().set_target_type("fill") self.add_name("_line_") self.__graph = graph self.__generate_paths() return
def __init__(self, graph=nx.Graph(), options=[]): Drawable.__init__(self, options) Named.__init__(self) self.style().set_target_type('fill') self.add_name('_line_') self.__graph = graph self.__generate_paths() return
def __init__(self, text = "", position = (0, 0)): Drawable.__init__(self) Translatable.__init__(self, position) Named.__init__(self) self.__text = text self.__font_size = 1 self.__scaled_direction = Vector(1, 0) return
def __init__(self, filename=None, buffers=None): Drawable.__init__(self) self.empty() if filename: self.fromFile(filename) elif buffers: self.v, self.n, self.t = buffers
def __init__( self , filename = None , buffers = None ) : Drawable.__init__( self ) self.empty() if filename : self.fromFile( filename ) elif buffers : self.v , self.n , self.t = buffers
def __init__(self, x, y, width=1, height=1, color="#5C5C5C"): Drawable.__init__(self, width * config.block_size, height * config.block_size) self.x = x self.y = y self.offset_x = self.__calculate_offset_coord(x) self.offset_y = self.__calculate_offset_coord(y) self.color = pygame.Color(color)
def __init__( self , files ) : Drawable.__init__( self ) self.meshes = [] for path in files : self.meshes.append( Mesh(path) ) self.colors = [ (.68,.16,.19) , (.68,.16,.19) , (.74,.73,.21) , (.15,.55,.27) , (.15,.55,.27) , (.14,.15,.12) ] self.sparks = Sparks()
def __init__(self): Drawable.__init__(self, *config.window_size) Eventable.__init__(self) self.children = [ ModeSwitchPanel(), PlaybackControlPanel(), EditorPanel() ] self.dirty = 2
def __init__(self, node_list, options=[]): Drawable.__init__(self, options) Named.__init__(self) self.__node_list = node_list cycle_graph = nx.Graph() if node_list: for n in range(1, len(node_list)): cycle_graph.add_edge(node_list[n - 1], node_list[n]) self.style().set_target_type('fill') self.__frame = OpenGraph(cycle_graph, options) self.__frame.style().set_target_type('frame') return
def __init__(self, x, y, direction): if direction == ROAD_DIRECTION.north or direction == ROAD_DIRECTION.south: Drawable.__init__(self, config.block_size + (2*config.road_size), config.road_size) else: Drawable.__init__(self, config.road_size, config.block_size + (2*config.road_size) ) self.direction = direction self.x = x self.y = y self.color = pygame.Color("#4A4A4A")
def __init__(self, node_list): Drawable.__init__(self) Named.__init__(self) self.__node_list = node_list cycle_graph = nx.Graph() if node_list: for n in range(1, len(node_list)): cycle_graph.add_edge(node_list[n - 1], node_list[n]) self.style().set_target_type("fill") self.__frame = OpenGraph(cycle_graph) self.__frame.style().set_target_type("frame") return
def __init__( self , f = None ) : Drawable.__init__( self ) self.verts , self.v , self.n , self.t , self.ev , self.et , self.tn = [[]] * 7 self.volume_size = 0 self.volume = np.zeros( 0 , np.float32 ) self.normal = np.zeros( 0 , np.float32 ) self.pts_len = 0 self.lpos = [0]*3 self.prog = None if file : self.fromFile( f )
def __init__(self): Drawable.__init__(self, 200, 50) self.font = pygame.font.Font(pygame.font.get_default_font(), 20) self.bg_color = pygame.Color("#242424") self.button_color = pygame.Color("#3B3B3B") self.button_color_alt = pygame.Color("#474747") self.fg_color = pygame.Color("#616161") self.button_build_hotzone = None self.button_run_hotzone = None sim_control.register_watcher("hud_mode_change", self) self.panel_mask = pygame.Rect(config.window_size[0] - self.w, 0, self.w, self.h)
def __init__(self, ship): self.direction = 1 self.step = 1 self.stages = [ '. ', '` ', ': ', ':.', ':`', '::' ] Drawable.__init__(self, self.get_art()) self.width = 3 self.set_color(curses.COLOR_YELLOW) self.set_attrs(curses.A_BOLD)
def __init__(self, f=None): Drawable.__init__(self) self.verts, self.v, self.n, self.t, self.ev, self.et, self.tn = [[] ] * 7 self.volume_size = 0 self.volume = np.zeros(0, np.float32) self.normal = np.zeros(0, np.float32) self.pts_len = 0 self.lpos = [0] * 3 self.prog = None if file: self.fromFile(f)
def __init__(self): Drawable.__init__(self, 355, 50) self.font = pygame.font.Font(pygame.font.get_default_font(), 20) self.bg_color = pygame.Color("#242424") self.button_color = pygame.Color("#3B3B3B") self.button_color_alt = pygame.Color("#474747") self.fg_color = pygame.Color("#616161") self.button_play_hotzone = None self.button_pause_hotzone = None self.button_play_x2_hotzone = None self.panel_mask = pygame.Rect(0, 0, self.w, self.h) sim_control.register_watcher("hud_mode_change", self)
def __init__(self, image, x, y, w, h, nbframes, blitx, blity): Drawable.__init__(self, image, x, y, w, h, nbframes, blitx, blity) self.speed = 1 self.originalspeed = 1 self.strength = 1 self.upspeed = 0 self.gravity = 6 self.speedy = 0 self.life = 1 self.direction = Vector2(-1, 0) self.updateframetime = 200 self.lastupdatejump = pygame.time.get_ticks() self.ismoving = False self.randomevent = random.randint(1000, 5000) self.score = 1 self.isattacking = False self.isdying = False
def __init__(self, image, x, y, nbcoins, radius, direction): Drawable.__init__(self, image, x, y, 16, 16, 4, 0, 32) self.coins = [] self.position = Rect(x, y, radius * 2, radius * 2) self.angle = 0.0 self.radius = radius self.lastupdateframe = pygame.time.get_ticks() self.updateframetime = 10 self.nbcoins = nbcoins self.direction = direction coinsize = 16 for i in range(nbcoins): obj = YellowCoin( image, self.position.centerx - coinsize / 2 + math.cos(self.angle) * radius, self.position.centery - coinsize / 2 - math.sin(self.angle) * radius) self.coins.append(obj) self.angle += (2 * math.pi) / nbcoins
def __init__(self, x, y, metadata): Drawable.__init__(self, config.block_size, config.block_size) self.x = x self.y = y self.draw_priority = 2 self.offset_x = self.__calculate_offset_coord(x) self.offset_y = self.__calculate_offset_coord(y) self.id = metadata["id"] self.description = metadata["description"] self.call_time = metadata["callTime"] self.leave_time = metadata["leaveTime"] self.travel_time = metadata["travelTime"] self.event_time = metadata["eventTime"] self.color = pygame.Color("#FFD900")
def __init__(self, hud_space): Drawable.__init__(self, "Hud_BG") Updatable.__init__(self) self.rect = hud_space #Make a black box for the background self.background = pygame.Surface( (self.rect.width, self.rect.height) ) self.background.fill( (0,0,0) ) #Make a simple health bar health_bar_box = pygame.Rect(self.rect.width/2 + 64, 16, self.rect.width/2 - 128, 32) health_bar_box.x += self.rect.x health_bar_box.y += self.rect.y self.health_bar = HealthBar(health_bar_box) #Make a kill counter kill_counter_box = pygame.Rect(16, 0, (32 * 6), 64) kill_counter_box.x += self.rect.x kill_counter_box.y += self.rect.y self.kill_counter = KillCounter(kill_counter_box)
def __init__(self, target1, target2, position): t1_shadow = target1.get_shadow() t2_shadow = target2.get_shadow() x1 = target1.scene.objects[target1.stacking_order].x2 + 1 x2 = target2.scene.objects[target2.stacking_order].x1 - 1 y = target1.scene.objects[target1.stacking_order].y1 for line in t1_shadow: if y == position: for x in range(len(line) - 1, 0, -1): if not line[x]: x1 -= 1 else: break break y += 1 y = target2.scene.objects[target2.stacking_order].y1 for line in t2_shadow: if y == position: for x in range(0, len(line) - 1): if not line[x]: x2 += 1 else: break break y += 1 Drawable.__init__(self, ''.ljust(x2 - x1 + 1, '-')) self.x_position = None self.speed = None self.x1 = x1 self.x2 = x2 self.y = position self.set_color(curses.COLOR_RED, curses.COLOR_BLACK) self.set_attrs(curses.A_BOLD)
def __init__(self, msg): width = 0 msg = msg.split('\n') height = len(msg) + 2 for line in msg: line = line.strip() if len(line) > width: width = len(line) Drawable.__init__(self, '') width += 2 self.art = [[' '] * width] for line in msg: line = line.strip() diff = width - len(line) art = [' '] * (diff // 2) for char in line: art.append(char) diff = width - len(art) art.extend([' '] * diff) self.art.append(art) self.art.append([' '] * width) self.shadow = [] for y in range(0, height): self.shadow.append([True] * width) self.width = width self.height = height self.set_attrs(curses.A_DIM) self.set_color(curses.COLOR_RED, curses.COLOR_WHITE)
def __init__(self): Drawable.__init__(self) self.arena_matrix = [ [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 0, 1, 3, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 4], [4, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 0, 1, 3, 1, 3, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 4], [4, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 0, 1, 3, 1, 3, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 4], [4, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 0, 1, 0, 1, 3, 1, 0, 1, 3, 1, 0, 1, 0, 1, 0, 4], [4, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 4], [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 4], [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]] self.arena_surface = self._load_arena_surface() self.non_destructible_walls = self._load_non_destructible_walls() self.destructible_walls = self._load_destructible_walls() self.players = list() self.physics = Physics(self)
def __init__(self, size): Drawable.__init__(self) self.size = map(lambda x: x * .5, size) self.m = tr.identity_matrix()
def __init__( self , size , m ) : Drawable.__init__( self ) self.size = map( lambda x : x*.5 , size ) self.m = m
def __init__(self, size = (0, 0)): Drawable.__init__(self) Scalable.__init__(self) self.__size = size return
def __init__(self, image, x, y): Drawable.__init__(self, image, x, y, 16, 16, 4, 0, 0) self.yorigin = y self.frame = 3
def __init__(self, image, x, y, value): Drawable.__init__(self, image, x, y, 36, 28, 1, 0, 511) self.screenfont = pygame.font.SysFont("Segoe Print", 18, True) self.value = value
def __init__(self, position, width, height): Drawable.__init__(self) self.x = position[0] self.y = position[1] self.width = width self.height = height
def __init__(self, health): Drawable.__init__(self, ".".rjust(health + 1)) self.health = health self.width = health self.set_color(curses.COLOR_WHITE, curses.COLOR_GREEN)
def __init__( self, x, y ): Point2D.__init__( self, x, y ) Physical.__init__( self ) Drawable.__init__( self )
def __init__(self, image, x, y): x -= 36 / 2 y -= 28 / 2 Drawable.__init__(self, image, x, y, 36, 28, 1, 0, 511)
def __init__( self , f = None ) : Drawable.__init__( self ) self.verts , self.v , self.n , self.t , self.ev , self.et = [[]] * 6 if file : self.fromFile( f )
def __init__(self): Drawable.__init__(self, "Hud_Elem") Updatable.__init__(self) Hud.hud_elements.append(self)
def __init__(self): w = config.grid_offset * config.map_size[0] + config.road_size * 2 h = config.grid_offset * config.map_size[1] + config.road_size * 2 Drawable.__init__(self, w, h) self.color = pygame.Color("#141414")
def __init__(self, image, x, y, w, h, nbframes): Drawable.__init__(self, image, x, y, w, h, nbframes, 0, 276)
def __init__( self , size ) : Drawable.__init__( self ) self.size = map( lambda x : x*.5 , size ) self.m = tr.identity_matrix()
def __init__(self, image, x, y, speed, range): Drawable.__init__(self, image, x, y, 25, 8, 1, 0, 592) self.direction = 1 self.speed = speed self.range = range
def __init__(self, character, color, location): Drawable.__init__(self, character, color, location, PLAYER_SIZE) HandlesEvents.__init__(self, []) self.events.append(MovementEvent)
def __init__(self, image, x, y, blitx, blity, w, h, nbframes, zindex): Drawable.__init__(self, image, x, y, w, h, nbframes, blitx, blity) self.zindex = zindex
def __init__( self ) : Drawable.__init__( self )
def __init__(self, assetfile, x, y, speed): Drawable.__init__(self, assetfile, x, y, 134, 66, 1, 0, 665) self.lastupdate = pygame.time.get_ticks() self.speed = -speed self.opacity = random.randint(50, 220)
def __init__(self, image, x, y): Drawable.__init__(self, image, x, y, 16, 16, 4, 0, 48) self.value = 1 self.coins = random.randrange(3, 10) self.yorigin = y self.jump = False
def __init__(self, image, x, y, w, h, blitx, blity): Drawable.__init__(self, image, x, y, w, h, 1, blitx, blity)
def __init__(self, image, x, y): Drawable.__init__(self, image, x, y, 16, 16, 4, 0, 32) self.value = 3
def __init__(self, location, angle, string): Drawable.__init__(self, string, (255, 255, 255), location, 12) HandlesEvents.__init__(self, [ UpdateEvent ]) self.location = location self.angle = angle
def __init__(self, image, x, y): Drawable.__init__(self, image, x, y, 16, 25, 5, 0, 215) self.value = 1
def __init__(self): Drawable.__init__(self, "Floor") self.image = loadImage("test_bgd_large.bmp", use_transparency = False) self.rect = self.image.get_rect()
def __init__(self, image, x, y, speed, range): Drawable.__init__(self, image, x, y, 80, 11, 1, 0, 500) self.direction = 1 self.speed = speed self.range = range
def __init__(self,pos): self.pos = pos Drawable.__init__(self)
def __init__(self, name, art): Drawable.__init__(self, art) self.add_attrs(curses.A_BOLD) self.name = name self.program = None