##### 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? ????t?0? ?? p?t? ====================================t?? ?? ȸҔ? ????t? D?Ȳ|? t????? ? ?? ?D? ??x??.??%?D? ????? ??%?tǘ? ?̬?? ??0? L?8?t??.<?`?,?ĳ??X? ??̸ ????D? ?t??? ??@? ?$???? JŔ?? (??????D? ??̸XՔ? ???? ????X????).?? ?,?Ƭ???

> HelloWorld!? ??ٳ?<?? ????tǌ? `? ??t??.???t? t?

? ?? ȸҔ? t????? ? ??t? D?̲ `?ȲT?t?X? ?D? ??|? ??t??.?Ż??? MѤ¸?|? ????|?L???Ƭ??? MѤ¸?X? ?X?? Initialstatement?? ? ?0?T?(?D? L?? ???.????t?,t? ?X?? Alwaysstatement?? ? ??p?tǸ???? X?t? ??.<?`?,????x? ???? DՔ?`? ??t??...image::Bagic-PROCESS-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-PROCESS-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-PROCESS-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-PROCESS-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()(MovingWorld?? ȸ?X? ???? T?ܴ |ǀ? @? ?? ????)(MovingWorld? L?t?x?t?ܴX? ??tǘ? DVDT?t???8?0????? ????x??.)#1-#5? Initial8?X? ???????? ???????.??,?? if-else8?@? Always8?X? ^ŀ????? ???????,#11t? Always8?X? ???????? ???????.#2-#10t? 4???D? ?̬?XՔ??ɔ? }??.Always8?t? ?? ? L? MovingWorldX? ????? t?????? ???|? ???? ???.X???̹ 8? ?? ???.MovingWorld?? ??ȹ?? `?|?L??MovingWorldX? ??ǔ? 踸?2??@? U???X??.(<????|??? Ȭ?|? tǩ?X?t?)X???̹ ??ȹ?? ???? MovingWorldX? ???? ? ?????tǃ?@? Always8?X? ??? ????ĳ|? ?? ?X??? JŔ? t??? L?Dż? ? ???.(tǃ?@? Always8?t? ??XՔ? H?ĳ?? 0?|? ?|??????)????? ??? ????ĳ?? ????0?ȹ? ?t??.???? ? t? ???@? ?? ? ? ???.?Ƭ??? t? ?? ȸ?X? ?? ??ĳt?|??? ?P?D? ???t?|? ??.?Ż????#1?? #11D? ??t?,Initialstatement?? pygame.time.Clock()h???,Always8??? tick(60)h??? ??L?D? U?x?`? ? ???.60t?|??? ? ??0? ? FPS(FramePerSecond)|? X?????.FPS? 1??? T?t?t? ??ȹ?? ???? ? ?????|? X?????.T?t?D? ?????(??p?tǸ?XՔ?)?tǌ???X? h?? 4???x????? Pygame.display.update()h??t??.??????,FPS?? 1??? Always8?t? ????? ???|? X???XՌ? ??.tǔ? Always8? ???Ŕ? ? X՘?X? Pygame.display.update()h??? tȬ?X?0? L?8?t??.FPS?? |ǅ?X? ????x? ??t? h??@? ?@? 0???(?????? ?̬? ??ĳ?? 0?|?)D? ??,????x? ??? h??? D?Ȳ???,FPS?t? ?4? l?t? FPS?? ??ٳX??? J?D? ? ???.?Ƭ?? ?? ȸ? ???? ? ???(FPS)D? ???? ? P?t?,??? ???? $? ? ȸ?X? ??? ???̹ >?DŴ?t? ?? $? ? ȸ?X? ??ĳ|? ?`? ? ???.pygame.time.Clock()@? ????t? ???0? t?? ??ĳ|? ???¤Д? 0???D? ??.tickh?? Pygame.display.update()??? ????? @?|? ??.?аX?t? tickh?? T?t?t? ?? ?? ??p?tǸ???Ŕ???|? Ĭ??X?0? L?8?t??.Pygame.display.update()h????? ????? ???|? XՔ? ?? H???? h?? ? X՘?t??.T?t?t? ??p?tǸ? ? L?,???D? ??XՔ? )???D? L?X??.??? ? T?t???䲔? ?????t? ????tǔ? T?t?t? ?????? ? ι<????,t?|? ?ܴ?? L?? ?Ǵ?|? ??.??췘?,t? ?? ȸҔ? ????? ?4? }? ?!??0? L?8??? ????t? D?̲ ?????? ??x?䲔? ??@? D???ĳ ???.(????|? ??? ??%?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("MovingWorldProject")myScreen=pygame.display.set_mode((640,480))myTextFont=pygame.font.Font("HoonWhitecatR.ttf",32)myText=myTextFont.render("MovingWorld!",True,red,green)myTextArea=myText.get_rect()myTextArea.center=(320,240)fpsClock=pygame.time.Clock()#1x=0#2y=0#3moveRight=1#4moveUp=1#5whileTrue:if(moveRight==1):#6x=x+1if(x>=320-75):moveRight=0elif(moveRight==0):#7x=x-1if(x<=-320+75):moveRight=1if(moveUp==1):#8y=y+1if(y>=240-15):moveUp=0elif(moveUp==0):#9y=y-1if(y<=-240+15):moveUp=1myTextArea.center=(320+x,240+y)#10myScreen.fill(white)myScreen.blit(myText,myTextArea)foreventinpygame.event.get():ifevent.type==QUIT:pygame.quit()sys.exit()pygame.display.update()fpsClock.tick(60)#11

Edit on GitHub