그래서 "z"키를 누를 때마다 텍스트 팝업이 나타나 잠시 동안 계속 blitted되도록 "씬"클래스에서 기능을 만들려고합니다.파이 게임 - 키를 누른 후에도 텍스트 블리핑
pygame.key.get_pressed()를 사용하면 Z를 누르고있는 동안 만 블리치가 발생합니다. Z가 눌 렸을 때 팝업되어 잠시 동안 화면에 계속 머물러 있기를 원합니다.
##This is inside the "scene" class##
def printText(self, surface):
if self.counter < 20:
text = pygame.font.SysFont("Pixelated Regular", 30)
label = text.render("Hello", 0, (0,0,0,))
surface.blit(label, (100,100))
self.counter += 1
##This is inside the main##
if key[pygame.K_z]:
robsHouse.printText(screen)
이런 경우에 나는 분명히 전에 만들 didnt는 : 나는 기본적으로 내가 "Z"의 가자 후에도 프레임의 몇 소총탄 할 수있는 텍스트합니다.
미리 감사드립니다. 당신은 텍스트가 사라 self.pressed
을 설정하려는 경우 다음에 다음
self.pressed = False
if key[pygame.K_z]:
self.pressed = True
if self.pressed:
robsHouse.printText(screen)
: 내가 무엇을 할 것이라고
귀하의 질문은 무엇입니까? – bansi