2017-11-16 13 views

답변

1

for event in pygame.event.get(): 이벤트 루프에서 이벤트 처리를 수행

import pygame as pg 


pg.init() 
screen = pg.display.set_mode((320, 240)) 
clock = pg.time.Clock() 
select_x = 164 
done = False 

while not done: 
    for event in pg.event.get(): 
     if event.type == pg.QUIT: 
      done = True 
     elif event.type == pg.KEYDOWN: 
      if event.key == pg.K_LEFT: 
       if select_x != 100: 
        select_x -= 64 
       else: 
        print("BORDER REACHED") 

    screen.fill((30, 30, 30)) 
    pg.display.flip() 
    clock.tick(30) 

pg.quit() 
+0

감사 형제 작정, u는 내 문제를 해결! –