def __init__(self, screen: pygame.Surface, args: dict, parent): ObjectBase.__init__(self, screen, args, parent) self.full_w = get_mandatory(args, "@w", int) self.full_h = get_mandatory(args, "@h", int) self.w = self.full_w self.h = self.full_h self.z = 0
def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'): ObjectBase.__init__(self, screen, args, parent) self.image = get_image("enemy") self.drawable = self.image self.w, self.h = self.image.get_size() self.angle = -90 self.drawable = self.rotate_object(self.image, self.angle - 90) self.curAngle = self.angle - 90 self.velocity = 100 self.scoreboard = self.get_all_type("Text")[0] # type: Text self.screen_c_w, self.screen_c_h = utils.get_surface_center( self.screen) self.tPlayer = None self.PlayerList = [None, None] self.realAngle = 0 for obj in self.siblings: if (obj.object_type == "Player"): print(obj.get_num()) if (obj.get_num() == 1): self.PlayerList[0] = obj self.tPlayer = obj else: self.PlayerList[1] = obj self.tPlayer = self.PlayerList[random.randint(0, 1)]
def __init__(self, screen:pygame.Surface, args: dict, parent:'Room'): args["@x"], args["@y"] = (-10, -10) ObjectBase.__init__(self, screen, args, parent) self.spawn_countdown = AlarmClock(1) self.spawn_countdown.start() self.difficulty_timer = AlarmClock(1) self.difficulty_timer.start()
def __init__(self, screen:pygame.Surface, args: dict, parent:'Room'): ObjectBase.__init__(self, screen, args, parent) self.angle = self.get_mandatory_arguement("angle", float) self.velocity = self.get_optional_arguement("velocity", 200, float) self.radius = 1 self.w = self.radius * 2 self.h = self.radius * 2
def __init__(self, screen: pygame.Surface, args: dict, parent): """ Objects which will not be drawn to the screen may inherit from this class instead of the ObjectBase class :param screen: The screen to draw the object to :param args: The dictionary of properties specified in the XML. :param parent: The room the object will live in """ args["@x"] = 0 args["@y"] = 0 ObjectBase.__init__(self, screen, args, parent)
def __init__(self, screen:pygame.Surface, args: dict, parent:'Room'): args["@x"] = 0 args["@y"] = 0 ObjectBase.__init__(self, screen, args, parent) self.src = get_mandatory(args, "@src", str) self.repetitions = get_optional(args, "@repeat", 0, int) self.channel = get_free_channel() self.playing = True self.repetition = -1 self.sound = get_sound(self.src)
def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'): ObjectBase.__init__(self, screen, args, parent) self.angle = 90 self.velocity = 200 self.number = self.get_mandatory_arguement("number", int) self.image = self.rotate_object(get_image("ghost".format(self.number))) self.w, self.h = self.image.get_size() self.shot_cool_down = AlarmClock(0.250) self.shot_cool_down.start()
def __init__(self, screen:pygame.Surface, args: dict, parent:'Room'): ObjectBase.__init__(self, screen, args, parent) self.image = get_image("enemy") self.drawable = self.image self.w, self.h = self.image.get_size() self.angle = 0 self.drawable = self.rotate_object(self.image, self.angle) self.velocity = 100 + GlobalVariable.wave*5 self.scoreboard = self.get_all_type("Text")[0] # type: Text self.screen_c_w, self.screen_c_h = utils.get_surface_center(self.screen)
def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'): ObjectBase.__init__(self, screen, args, parent) self.image = get_image("doublestackpumpkin") self.drawable = self.image self.w, self.h = self.image.get_size() self.angle = 0 self.drawable = self.rotate_object(self.image, self.angle - 90) self.velocity = 100 self.scoreboard = self.get_all_type("Text")[0] # type: Text self.screen_c_w, self.screen_c_h = utils.get_surface_center( self.screen) self.bulletCounter = 0
def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'): ObjectBase.__init__(self, screen, args, parent) self.font = get_font(self.get_mandatory_arguement( "font", str)) # type: pygame.font.Font self.text = self.get_mandatory_arguement("text", str) self.antialiasing = bool( self.get_optional_arguement("antialiasing", 1, int, blank_means_unset=True)) self.color = utils.convert_color( self.get_optional_arguement("color", "White", str, blank_means_unset=True)) self.text_object = None self.rebuild_text_object()
def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'): ObjectBase.__init__(self, screen, args, parent) self.respawn_countdown = AlarmClock(5.0) self.respawn_countdown.start() self.isDead = False self.angle = 90 self.velocity = 5 self.number = self.get_mandatory_arguement("number", int) self.image = self.rotate_object( get_image("player{}".format(self.number))) self.w, self.h = self.image.get_size() self.shot_cool_down = AlarmClock(0.125) self.shot_cool_down.start() self.display_image = self.image self.angle = 0
def __init__(self, screen: pygame.Surface, args: dict, parent): ObjectBase.__init__(self, screen, args, parent) self.color = (0, 255, 0) self.font_name = self.get_mandatory_arguement("font", str) self.font = get_font(self.font_name) self.value = self.get_mandatory_arguement("text", str) self.text = self.font.render(self.value, True, self.color) self.set_width( self.get_optional_arguement("w", self.text.get_width(), int)) self.set_height( self.get_optional_arguement("h", self.text.get_height(), int)) self.sup = self.get_mandatory_arguement("supplementary", str) self.outline = pygame.Rect(self.rect) self.visible = bool(self.get_optional_arguement("visible", 1, int)) self.text_x = self.x + ((self.w / 2) - (self.text.get_width() / 2)) self.text_y = self.y + ((self.h / 2) - (self.text.get_height() / 2))
def __init__(self, screen:pygame.Surface, args: dict, parent:'Room'): ObjectBase.__init__(self, screen, args, parent) self.can_fall = False
def __init__(self, screen, args, parent): ObjectBase.__init__(self, screen, args, parent) self.image = get_image(self.get_mandatory_arguement("image", str)) self.scale = self.get_optional_arguement("scale", 1, float) self.reload_image()
def __init__(self, **kwargs): ObjectBase.__init__(self, **kwargs)
def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'): ObjectBase.__init__(self, screen, args, parent) self.angle = self.get_mandatory_arguement("angle", float) self.velocity = self.get_optional_arguement("velocity", 400, float) self.image = get_image("bullet")
def __init__(self, screen, args, parent): ObjectBase.__init__(self, screen, args, parent) self.spritesheet = get_spritesheet(self.get_mandatory_arguement("src", str))
def __init__(self, **kwargs): """ A generic block which can be used in any level :param kwargs: a dictionary of configurations (do not instantiate this class yourself) """ ObjectBase.__init__(self, **kwargs)
def __init__(self, screen: pygame.Surface, args: dict, parent: 'Room'): ObjectBase.__init__(self, screen, args, parent) self.image = get_image("gameover")