##### pygame documentation | Pygame Home || Help Contents || Reference Index Most useful stuff: Color | display | draw | event | font | image | key | locals | mixer | mouse | Rect | Surface | time | music | pygame Advanced stuff: cursors | joystick | mask | sprite | transform | BufferProxy | freetype | gfxdraw | midi | Overlay | PixelArray | pixelcopy | sndarray | surfarray | math Other: camera | cdrom | examples | fastevent | scrap | tests | touch | version

??====================================Author:YoungwookKim(Korean)========================================================================Contact:rumia0601@gmail.com========================================================================0?? ??%? ========================================================================-????? ??%?@? ????? tǤ??? ====================================???t???t?,?Ƭ??? 4????|? ??%?XՔ? )???D? <?? 0????(

> HelloWorld|? \???t??|?)4????|? ??%?XՔ? )???@? ????? 0????.? ??????аt? ??%?@? ???? ???????? ? D??p?t?t? D?Ȳ??̹,??%?@? ??? ???????? ? m??? D??p?t?t?0? L?8?t??.(??????X? ?X?:0

? t???X? ??%?,1? t???X? ??%?)??췘?,??? ????@? ??%?t? DՔ?X??.????t? ?Ƭ???

> ???? ????D? Play?? |?? йXՔ? t? ?t??.Play|??? 貴Ŕ? ??X? |ǀ???(D?ȹĳ ???}?)D? ????x?䲔? ;?t??.?? ??,t? ??

ȸ?? ???? ????t? ?0? ?t? ??%? ???D? ???t?????...image::Bagic-INPUT-sourcecode.png:class:inlined-right..code-block::python:linenos:importsys,pygamepygame.init()size=width,height=220,140speed=[2,2]black=0,0,0screen=pygame.display.set_mode(size)ball=pygame.image.load("Bagic-INPUT-sourcecode.png")ballrect=ball.get_rect()while1:foreventinpygame.event.get():ifevent.type==pygame.QUIT:sys.exit()ballrect=ballrect.move(speed)ifballrect.left<0orballrect.right>width:speed[0]=-speed[0]ifballrect.top<0orballrect.bottom>height:speed[1]=-speed[1]screen.fill(black)screen.blit(ball,ballrect)pygame.display.flip()..image::Bagic-INPUT-resultscreen.png:class:inlined-right..code-block::python:linenos:importsys,pygamepygame.init()size=width,height=220,140speed=[2,2]black=0,0,0screen=pygame.display.set_mode(size)ball=pygame.image.load("Bagic-INPUT-resultscreen.png")ballrect=ball.get_rect()while1:foreventinpygame.event.get():ifevent.type==pygame.QUIT:sys.exit()ballrect=ballrect.move(speed)ifballrect.left<0orballrect.right>width:speed[0]=-speed[0]ifballrect.top<0orballrect.bottom>height:speed[1]=-speed[1]screen.fill(black)screen.blit(ball,ballrect)pygame.display.flip()(ControllingWorld?? ȸ?X? ???? T?ܴ |ǀ? @? ?? ????)(ControllingWorld? ????ܴ )??դ?|? ?t?t? t??? )???<?? ????x??.)t?? ?? ȸ?@? D?P?X??? 2?X? p? (?t??t? ?????.???ɔ? #5?? KEWDOWNtǤ???? ?Ҭ?p? ??Ŕ??? D?̲??|? ??XՔ? ??t??.?x? ??@? t??X? L?ବ???X? }?? ?t??? ٳ??X?ĳ]? ??? ???? ????X??.??@? ??9???? Event8? ^??? ?ǐ?а ???? ?ǐ?а ?????? D?Ȉ? ?|??? ? ??L?D? ?Ƭ??? L?? ???.???|? ??p?tǸ?XՔ? ????,Event8?t? ??̸?? t?踴????? ?ȩ?t?|?.(8?? ? ?? ??p?tǸ? ??.????t? P????? (?t??t??.)??? event.key?? ????ܴ?? ȹ??ɹ<?? ??? ??|? X?????.l????x? ??X? tǄ?D? ??D?|?.K_UP,K_LEFT,K_DOWN,K_RIGHT.买? ????x? K_?¬???t??.(HeaderX? pygame.locals???0? tǩ?`? ? ???.)?x? ??X? tǄ?<???? K_8,K_a,K_L,K_LCTRL,K_DELETE,L_F4?t? ???.t?? ???ĳ ????x? ĳ?? ??t? ????<?? t?t?`? ? ???.??? ?? tǄ? ??]?@? https://www.pygame.org/docs/ref/key.html#pygame.key.name?? ? U?x?`? ? ???.KEWDOWN@?

> t? ?Д? t???Ŕ? ????? J?X???̹,???@? ?8??.|? \X???X??,\ \ t?Ȁ?0? \???L??? \Ĭ?? \ ??? \D?\? \???.\ |? \X???X??ɔ? \JŔ??.\ \ ?$??ǔ? \????|? ??0? ?t?

???,KEYUPt?|??? tǤ???|? ????<?? U?x?t?|? ??.(???@? L?ବ???t? T? ??? ??)tǔ? ??T? ?????? ? ?踠??.??%?D? ???XՔ? ??@? ? ? tǤ??? xǐ?|? ???XՔ? ??t?0? L?8??? }??.t? ? ???? ?? ȸҔ? D?1?????.?аX?t? ?? ȸ?? ??%?,?̬?,??%?D? ???? ??0? L?8?t??.޹????D?Ȳ?.t? ?? ȸҔ? ???? $? ? ȸ?? ??8֑ǩ?t? ?? ???,??t? ܭY?(?}?p?t?(HP,??? ?)ĳ ??? ??ĳ ???)t? ???,??8? ??(ٳ0????? ?ƌ?,??%? ??%?X? 䲑?1?,??P? ?)t? ??0? L?8??? ????t?|?? ???? ? ???.?? ?,????X? x?0ј?tǤ?/?¤??D? ??1?XՌ? X?0? ?t? ?Ƭ??? ??T? ? ??%?(ȹ?Ƥ? ???? ??),?̬?(??? h??T?),??%?(t?????,???? ? ???? p?t?0? ???T? )???)D? L?D?|? ??.<?`?,0?? ?Ĭ?? ?X? ????t? ?ܴ?? ĳ??t? ??.??T? ?Ĭ? ?????!<8?? T?ܴ>::importpygame,sysfrompygame.localsimport*white=(255,255,255)red=(255,0,0)green=(0,255,0)pygame.init()pygame.display.set_caption("ControllingWorldProject")myScreen=pygame.display.set_mode((640,480))myTextFont=pygame.font.Font("HoonWhitecatR.ttf",32)myText=myTextFont.render("ControllingWorld!",True,red,green)myTextArea=myText.get_rect()myTextArea.center=(320,240)fpsClock=pygame.time.Clock()x=0y=0moveRight=0#1moveDown=0#2whileTrue:moveRight=0#3moveDown=0#4myTextArea.center=(320+x,240+y)myScreen.fill(white)myScreen.blit(myText,myTextArea)foreventinpygame.event.get():ifevent.type==QUIT:pygame.quit()sys.exit()elifevent.type==KEYDOWN:#5ifevent.key==K_UP:moveDown=-1moveRight=0elifevent.key==K_LEFT:moveDown=0moveRight=-1elifevent.key==K_DOWN:moveDown=1moveRight=0elifevent.key==K_RIGHT:moveDown=0moveRight=1if(moveRight==1):#6x=x+10elif(moveRight==-1):#7x=x-10if(moveDown==1):#8y=y+10elif(moveDown==-1):#9y=y-10pygame.display.update()

Edit on GitHub