def run(self):
# while no other GUI elements are visible or not in battle
while this.drawing & (not (this.text_box_visible | this.text_menu_visible | this.inbattle)):
pygame.event.pump()
event = pygame.event.poll()
if event.type == pygame.KEYDOWN:
# get keys pressed using pygame.key.get_pressed() as it is more continous than events.
if event.key == pygame.K_LCTRL:
# seperate hide and show buttons as they would counteract eachother.
self.player_menu.show()
elif event.key == pygame.K_z:
self.activate()
elif event.key == pygame.K_f:
# quick testing key to find if the battles work has to be with a background
# where Lucidia Bright is present.
battle(self, this.onscreen_sprites["Lucida Bright"])
pygame.time.delay(5)
keys = pygame.key.get_pressed()
if keys[pygame.K_UP]:
self.facing("backward")
self.move(0, -1)
elif keys[pygame.K_DOWN]:
self.facing("forward")
self.move(0, 1)
elif keys[pygame.K_LEFT]:
self.facing("left")
self.move(-1, 0)
elif keys[pygame.K_RIGHT]:
self.facing("right")
self.move(1, 0)
评论列表
文章目录