def popup_worker(self): globals.event_lock = True self.popup = popup.TextPopup(['Hello World!^1/'], self.draw_recvd_surface) self.popup.start() while not self.popup.finished: self.popup.draw() globals.event_lock = False draw.get_layer(self.weight).destroy()
def draw_recvd_surface(self): l = draw.get_layer(self.weight) r: pygame.Rect = self.popup.surface.get_rect() r.bottomright = globals.screen_rect.bottomright l.surface.blit(self.popup.surface, (0, 0)) # TODO: make this more accurate. Critical. l.flip()
def __init__(self): Room.__init__(self) self.clock = pygame.time.Clock() self.chara = globals.chara self.chara_layer = draw.get_layer(128) self.walk_animate_init() self.walk_tick = 0 self.c = 0
def draw(self): for i in self.objects: i.redraw() i.sprite.update() layer = draw.get_layer(i.weight) layer.surface.blit(i.sprite.image[0], i.pos) layer.flip() self.c += 1 if self.c >= 30: self.c = 0 globals.time += 1 self.clock.tick(30)
def __init__(self): super().__init__() self.id = 291 self.image = sprite.Sprite.get_sprite('spr_fakeintro', 2) self.image2 = sprite.Sprite.get_sprite('spr_fakeintro2', 2) self.image.rect.x = 0 self.image.rect.y = 0 self.text_layer = draw.get_layer(32768) self.text = [ "Long ago^1, two races&ruled over Earth^1:&HUMANS and MONSTERS. \E1 ^1 %", "One day^1, th^7ey all&disappeared without&a trace." ]
def update(self): self.layer = draw.get_layer(64) if self.dirty and not self.finished: self.layer.surface.fill(pygame.Color('black')) pygame.draw.rect(self.layer.surface, pygame.Color('white'), self.layer.surface.get_rect(), 4) self.layer.surface.blit(self.text_name, (32, 32)) self.layer.surface.blit(self.text_lv, (180, 32)) self.layer.surface.blit(self.text_time, (328, 32)) self.layer.surface.blit(self.text_location, (32, 75)) self.layer.surface.blit(self.text_save, (64, 138)) self.layer.surface.blit(self.text_return, (253, 138)) self.layer.surface.blit(self.heart.image[0], (35, 138) if self.cursor == 1 else (224, 138)) self.dirty = False self.layer.flip()
def __init__(self, *args): self.id = 0 self.name = '' self.background_layer = draw.get_layer(65536) self.background = pygame.Surface((globals.width, globals.height)) self.bg_pan = (0, 0) self.objects = [] self.song = None self.run_update = True self.entered = False self.exited = False self.update_thread = threading.Thread(target=self.update_loop, name='update loop for {}'.format( self.__class__.__name__), daemon=True) self.update_thread.start() self.c = 0 self.clock = pygame.time.Clock()
def __init__(self): super().__init__() self.image = sprite.Sprite.get_sprite('spr_introimage', 2) self.image.rect.x = 0 self.image.rect.y = 0 self.id = 1 self.text_layer = draw.get_layer(32768) self.leave_intro = False self.text = [ "Long ago^1, two races&ruled over Earth^1:&HUMANS and MONSTERS^5. ^1 ", "One day^1, war broke&out between the two&races^5. ^1 ", "After a long battle^1,&the humans were&victorious^5. ^1 ", "They sealed the monsters&underground with a magic&spell^4. ^1 ", "Many years later^2.^2.^4. ^1 ", " MT. EBOTT& 201X^9 ", "Legends say that those&who climb the mountain&never return^5.^3 ", " ^9 ^5 ", " ^9 ^5 ", " ^9 ^9 ^9 ^9 ^9 ^9 " ]
def __init__(self): super().__init__() self.layer = draw.get_layer(64) self.layer.show() self.layer.surface = pygame.Surface((445, 186)) self.rect = self.layer.surface.get_rect() self.rect.center = globals.center self.layer.shift = self.rect.topleft # TODO: fix the coords below so this is not needed. self.cursor = 1 self.saved = False self.finished = False self.text_name = font.render(globals.chara.charname) self.text_lv = font.render('LV {}'.format(str(globals.chara.lv))) self.text_time = font.render(globals.chara.get_play_time()) self.text_location = font.render(globals.last_save_room_name) self.text_save = font.render('Save') self.text_return = font.render('Return') self.heart = sprite.Sprite.get_sprite('spr_heart') sfx.get_sound(0x29fb).play() self.update()
def __init__(self): super().__init__() self.id = 2 self.text_layer = draw.get_layer(32768) self.return_ = True