def make_image(self, text_text, color, bg_color, angle, but_width, but_height): text = self.font.render("{}".format(text_text), 1, pygame.Color(color)) screen.fill(pygame.Color(bg_color)) screen.blit(text, (0, 0)) pygame.draw.rect(screen, pygame.color.Color(color), (0, 0, but_width, but_height), 1) image = screen.subsurface((0, 0, but_width, but_height)).copy() return pygame.transform.rotate(image, angle)
def text_to_screen(item): rect = pygame.draw.rect(screen,(0,0,0), (0,310,500,50)) pygame.display.update(rect) font = pygame.font.SysFont("Arial", 30) label = font.render("Thats a " +str(item)+ "!", 1,(255,0,0)) screen.blit(label, (23,320)) pygame.display.update()
def display_left_arrow(x,y,left_arrow, left_arrow_room3_patch): if ((x in range(0,56)) and (y in range(100,166))): left_arrow.set_colorkey((255,0,255)) screen.blit(left_arrow,(0,100)) pygame.display.update(0,100,56,66) else: from room3 import remove_left_arrow remove_left_arrow(left_arrow_room3_patch)
def display_right_arrow(x,y,right_arrow, right_arrow_room3_patch): if ((x in range(444,497)) and (y in range(100,166))): right_arrow.set_colorkey((255,0,255)) screen.blit(right_arrow,(444,100)) pygame.display.update(444,100,53,66) else: from room3 import remove_right_arrow remove_right_arrow(right_arrow_room3_patch)
def make_text(self, text, color, bg_color): words = text.split() space = self.font.size(' ')[0] max_width = 200 screen.fill(pygame.Color(bg_color)) x, y = 0, 0 for word in words: word_surface = self.font.render(word, 1, pygame.color.Color(color)) word_width, word_height = word_surface.get_size() if x + word_width >= max_width: x = 0 y += word_height screen.blit(word_surface, (x, y)) x += word_width + space self.image = screen.subsurface((0, 0, 200, y + 31)).copy()
def remove_left_arrow(left_arrow_room3_patch): screen.blit(left_arrow_room3_patch,(0,100)) pygame.display.update(0,100,56,66)
def remove_right_arrow(right_arrow_room3_patch): screen.blit(right_arrow_room3_patch,(444,100)) pygame.display.update(444,100,53,66)
def screen_stuff(screen): current_room = pygame.image.load(os.path.join("room_images","room3.png")).convert() screen.blit(current_room,(0,0)) pygame.draw.rect(screen,(0,0,0), (0,310,500,50)) # creates menu bar at bottom of Room pygame.display.flip()
def moving_bear(bear, bx, by): bear.set_colorkey((255,0,255)) screen.blit(bear,(bx,by)) pygame.display.flip()
def bear_blit(bear): bear.set_colorkey((255,0,255)) screen.blit(bear,(300,190)) pygame.display.update(300,190,55,50)