def build_animation(self, sequence_id, frames, scale=1, rotation=0, dim_value=255, flip=[False, False]): """Build the animation """ self.sequence_dict[sequence_id] = [] if not self.current_sequence: self.current_sequence = sequence_id # check frames is a list or a single image try: for frame in frames: try: # check if the frame exists self.sequence_dict[sequence_id].append( self.frame_dict[frame]) except: self.frame_dict[frame] = (utility.load_image( frame, scale, rotation, dim_value, flip)) self.sequence_dict[sequence_id].append( self.frame_dict[frame]) except: try: # check if the frame exists self.sequence_dict[sequence_id].append(self.frame_dict[frames]) except: self.frame_dict[frames] = (utility.load_image( frames, scale, rotation, dim_value, flip)) self.sequence_dict[sequence_id].append(self.frame_dict[frames]) self.image = self.sequence_dict[self.current_sequence][ self.current_frame]
def build_animation(self, sequence_id, frames): self.sequence_dict[sequence_id] = [] if not self.current_sequence: self.current_sequence = sequence_id try: for frame in frames: try: self.sequence_dict[sequence_id].append(self.frame_dict[frame]) except: self.frame_dict[frame] = (utility.load_image(frame)) self.sequence_dict[sequence_id].append(self.frame_dict[frame]) except: try: self.sequence_dict[sequence_id].append(self.frame_dict[frames]) except: self.frame_dict[frames] = (utility.load_image(frames)) self.sequence_dict[sequence_id].append(self.frame_dict[frames]) self.image = self.sequence_dict[self.current_sequence][self.current_frame]
def __init__(self, surface, target, life_timer=-1): actor.Actor.__init__(self) self.surface = surface self.surface_rect = self.surface.get_rect() self.mounted = False self.target = target self.image = None self.balloon_pointer_down = utility.load_image('balloonPointerDown') self.balloon_pointer_up = utility.load_image('balloonPointerUp') self.balloon_pointer_direction = 'Down' self.rect = None self.velocity = vector.Vector2d.zero self.bounds = 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT self.bound_style = BOUND_STYLE_CUSTOM self.offset = vector.Vector2d.zero self.life_timer = life_timer self.position = target.position + self.offset self.mounted = True self.balloon_pointer_rect = None self.create_bubble() self.update()
def load_data(): BossTut.music = utility.load_sound('bossMusic') BossTut.bullet_sound = utility.load_sound('baakeHit') BossTut.hurt_sound = utility.load_sound('hurtBoss') BossTut.how_to_kill = utility.load_image('howToBoss1') BossTut.master_animation_list.build_animation('idle', ['boss1']) BossTut.master_animation_list.build_animation('hurt', ['boss1', 'boss1', 'boss1_1', 'boss1_1']) BaakeBoss.music = utility.load_sound('bossMusic') BaakeBoss.bullet_sound = utility.load_sound('baakeHit') BaakeBoss.hurt_sound = utility.load_sound('hurtBoss') BaakeBoss.how_to_kill = utility.load_image('howToBoss1') BaakeBoss.master_animation_list.build_animation('idle', ['boss0']) BaakeBoss.master_animation_list.build_animation('hurt', ['boss0', 'boss0', 'boss0_1', 'boss0_1']) MoonoBoss.music = utility.load_sound('bossMusic') MoonoBoss.bullet_sound = utility.load_sound('baakeHit') MoonoBoss.hurt_sound = utility.load_sound('hurtBoss') MoonoBoss.shield_break = utility.load_sound('shieldBreak') MoonoBoss.shield_restore = utility.load_sound('shieldRestore') MoonoBoss.how_to_kill = utility.load_image('howToBoss3') MoonoBoss.master_animation_list.build_animation('idle', ['boss2idle_0', 'boss2idle_1', 'boss2idle_2', 'boss2idle_3', 'boss2idle_4', 'boss2idle_5', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0', 'boss2idle_0']) MoonoBoss.master_animation_list.build_animation('vulnerable', ['boss2v']) MoonoBoss.master_animation_list.build_animation('hurt', ['boss2_1'])
args = get_optimization_style_image_arguments(parser.parse_args()) try: tf.config.optimizer.set_jit(True) except: pass input_shape = args["image_size"] content_path = args["image"] style_path = args["style"] epochs = args["epochs"] if content_path.startswith("http"): content_image = load_url_image(content_path, dim=input_shape, resize=True) else: content_image = load_image(content_path, dim=input_shape, resize=True) content_image = content_image / 255.0 content_image = content_image.astype(np.float32) content_image = np.expand_dims(content_image, axis=0) print("Content image loaded ...") if style_path.startswith("http"): style_image = load_url_image(style_path, dim=input_shape, resize=True) else: style_image = load_image(style_path, dim=input_shape, resize=True) style_image = style_image / 255.0 style_image = style_image.astype(np.float32) style_image = np.expand_dims(style_image, axis=0) print("Style image loaded ...") loss_model = get_loss_model(args["content_layers"], args["style_layers"])
from scenes import credits, scene, splashscreen from ui import menu, text from utils import prettyprint, utility, vector from utils.settings import * pygame.init() utility.read_settings() if settings_list[SETTING_FULLSCREEN]: screen = utility.set_fullscreen() else: screen = utility.set_fullscreen(False) pygame.display.set_icon(utility.load_image('icon')) pygame.display.set_caption('Trouble In CloudLand v1.1') screen.fill((0, 0, 0)) tempText = text.Text(FONT_PATH, 36, (255, 255, 255)) tempText.set_text('Loading...') tempText.position = vector.Vector2d( (SCREEN_WIDTH / 2) - (tempText.image.get_width() / 2), (SCREEN_HEIGHT / 2) - (tempText.image.get_height() / 2)) tempText.update() tempText.draw(screen) pygame.display.flip() try: pygame.mixer.set_reserved(MUSIC_CHANNEL) pygame.mixer.Channel(MUSIC_CHANNEL).set_volume(1)
default=[256, 256], help='output image size') parser.add_argument("--output", "-out", default="output", help="directory path to save output images") args = get_style_multi_images_arguments(parser.parse_args()) try: tf.config.optimizer.set_jit(True) except: pass path = args["path"] images = os.listdir(path) output_path = args["output"] for img in images: style_model = ImageTransformNet() style_model.load_weights(args["checkpoint"]) input_shape = args["image_size"] image_path = os.path.join(path, img) name = img.split(".")[0] image = load_image(image_path, dim=input_shape) start = time.time() styled_image = inference(style_model, image) end = time.time() print(f"Time Taken: {end-start:.2f}s") pil_image = array_to_img(styled_image) pil_image.save(f"{output_path}/{name}.jpg")
from ui import menu, text from utils import prettyprint, utility, vector from utils.settings import * pygame.init() utility.read_settings() if settings_list[SETTING_FULLSCREEN]: screen = utility.set_fullscreen() else: screen = utility.set_fullscreen(False) pygame.display.set_icon(utility.load_image('icon')) pygame.display.set_caption('Trouble In CloudLand v1.1') screen.fill((0, 0, 0)) tempText = text.Text(FONT_PATH, 36, (255, 255, 255)) tempText.set_text('Loading...') tempText.position = vector.Vector2d((SCREEN_WIDTH / 2) - (tempText.image.get_width() / 2), (SCREEN_HEIGHT / 2) - (tempText.image.get_height() / 2)) tempText.update() tempText.draw(screen) pygame.display.flip() try: pygame.mixer.set_reserved(MUSIC_CHANNEL) pygame.mixer.Channel(MUSIC_CHANNEL).set_volume(1) pygame.mixer.set_reserved(PLAYER_CHANNEL)