LogIn E-mail
¼³°èÀ̾߱â
house.py
# 26 jinsung    70.1.1 09:00

import pygame
 
# Initialize the game engine
pygame.init()
 
# Define the colors we will use in RGB format
BLACK= ( 0,  0,  0)
WHITE= (255,255,255)
BLUE = ( 0,  0,255)
GREEN= ( 0,255,  0)
YELLOW=(255,255,0)
RED  = (255,  0,  0)
 
# Set the height and width of the screen
size  = [400,300]
screen= pygame.display.set_mode(size)
 
pygame.display.set_caption("Game Title")
 
#Loop until the user clicks the close button.
done= False
clock= pygame.time.Clock()
n=0
 
while True :
 
    # This limits the while loop to a max of 10 times per second.
    # Leave this out and we will use all CPU we can.
    clock.tick(10)
     
    # Main Event Loop
    for event in pygame.event.get():# User did something
        if event.type == pygame.QUIT:# If user clicked close
            done=True # Flag that we are done so we exit this loop
 
    # All drawing code happens after the for loop and but
    # inside the main while done==False loop.
     
    # Clear the screen and set the screen background
    screen.fill(WHITE)
 
    pygame.draw.rect(screen, RED, [170,100,30,50],0)
    pygame.draw.polygon(screen, GREEN, [[30,150], [125,100], [220,150]],5)
    pygame.draw.polygon(screen, GREEN, [[30,150], [125,100], [220,150]],0)
    pygame.draw.lines(screen, RED,False, [[50,150], [50,250], [200,250], [200,150]],5)
    pygame.draw.rect(screen, BLACK, [75,175,75,50],5)
    pygame.draw.rect(screen, BLUE, [75,175,75,50],0)
    pygame.draw.line(screen, BLACK, [112,175], [112,225],5)
    pygame.draw.line(screen, BLACK, [75,200], [150,200],5)
    n=n+1
    if n > 20:  n=0
    pygame.draw.circle(screen, YELLOW, (185+(n*3),80-(n*5)),10)
    m=n+7
    if m > 20: m=m-20
    pygame.draw.circle(screen, YELLOW, (185+(m*3),80-(m*5)),10)
    l=m+7
    if l > 20: l=l-20
    pygame.draw.circle(screen, YELLOW, (185+(l*3),80-(l*5)),10)
    # Go ahead and update the screen with what we've drawn.
    # This MUST happen after all the other drawing commands.
    pygame.display.flip()
 
# Be IDLE friendly
pygame.quit()

°Ô½Ã¹°: 25 °Ç, ÇöÀç: 1 / 1 ÂÊ
[1]
¹øÈ£ Á¦       ¸ñ ÀÛ¼ºÀÚ µî·ÏÀÏ ¹æ¹®
26  house.py jinsung 21.3.18 20
25  move_circle_j1.py jinsung 21.3.18 12
24  bounce_j1.py jinsung 21.3.18 8
23  ¸ðµÎÀÇ ÆÄÀ̽ã - 20Àϸ¸¿¡¹è¿ì´Â ÇÁ·Î±×·¡¹Ö ±âÃÊ JMJS 20.1.8 175
22  python -m pip install -U pip JMJS 19.11.25 161
21  get =lambda i,m ... JMJS 19.11.13 173
20  2Â÷¿ø ¸®½ºÆ®, Æ©Çà JMJS 19.11.13 168
19  [turtle]def polygon3(n,c,d) JMJS 19.11.11 155
18  [turtle]def polygon2(n,a) JMJS 19.11.11 160
17  def factorial(n) JMJS 19.11.11 151
16  def sum_func(n) JMJS 19.11.11 162
15  def hello() fun1(a) fun2(a,b) JMJS 19.11.11 170
14  while sum JMJS 19.11.11 144
13  random calculation JMJS 19.11.11 149
12  turtle random JMJS 19.11.11 151
11  import time time.time JMJS 19.11.11 164
10  turtle begin_fill end_fill JMJS 19.11.11 155
9  if else JMJS 19.11.11 153
8  input JMJS 19.11.11 158
7  list JMJS 19.11.11 176
6  turtle triangle JMJS 19.11.11 162
5  for range JMJS 19.11.11 143
4  ¸ðµâ »ç¿ëÇϱâ JMJS 19.11.11 166
3  import ÆÄÀ̽㠸ðµâ °¡Á®´Ù ¾²±â JMJS 19.11.11 161
1  print ÁÙ¹Ù²Þ JMJS 19.11.11 200
[1]