'''
클래스(class) : 설계도, 틀
객체(object) : 틀로 찍어낸 물체 = 인스턴스
메소드 (method) : 클래스 내부의 함수
필드 (field) : 객체의 특징을 저장하는 변수
상속 : 물려받는거
'''
'''
class Person :
def __init__(self,x): # 생성자 : 객체를 만들때 실행되는 함수
print("Person 객체가 생성되었습니다.")
self.name = x
def setName(self,x):
self.name = x
def speak(self):
print("저는 ",self.name,"입니다")
class Student(Person) :
air = "good" #클래스 변수 (같은 클래스로 만든 객체들이 공유하는 변수)
def __init__(self,x,y):
super().__init__(x) #super 클래스의 생성자 실행하기
self.school = y
def speak(self): #super 클래스의 speak 메소드 오버라이딩 (덮어쓰기)
super().speak()
print("그리고 ",self.school,"에 다녀요")
a = Student("name","신풍초")
a.speak()
print(a.air)
b = Student("mame","상현초")
print(b.air)
Student.air = "bad"
print(a.air)
# a = Person("aaa") # a 객체 생성
# a.speak() # a 객체의 speak 메소드 실행
#
# b = Person("bbb")
# b.speak()
'''
import pygame # 1. pygame 선언
pygame.init() # 2. pygame 초기화
# 3. pygame에 사용되는 전역변수 선언
WHITE = (255, 255, 255)
size = [400, 300]
screen = pygame.display.set_mode(size)
done = False
clock = pygame.time.Clock()
# pygame에 사용하도록 비행기 이미지를 호출
airplane = pygame.image.load('images/plane.png')
airplane = pygame.transform.scale(airplane, (60, 45))
# 4. pygame 무한루프
def runGame():
global done, airplane
x = 20
y = 24
while not done:
clock.tick(10)
screen.fill(WHITE)
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# 방향키 입력에 대한 이벤트 처리
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
y -= 10
elif event.key == pygame.K_DOWN:
y += 10
screen.blit(airplane, (x, y))
pygame.display.update()
runGame()
pygame.quit()
https://woong-garden.tistory.com/entry/17-%ED%8C%8C%EC%9D%B4%EC%8D%AC-%EC%88%AB%EC%9E%90%EC%95%BC%EA%B5%AC%EA%B2%8C%EC%9E%84-%EB%A7%8C%EB%93%A4%EA%B8%B0
https://ai-creator.tistory.com/522top of page

실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
수정: 9월 10일
2025.09.10 (중간)
2025.09.10 (중간)
댓글 0개
좋아요
댓글(0)
더 이상 게시물에 대한 댓글 기능이 지원되지 않습니다. 자세한 사항은 사이트 소유자에게 문의하세요.
bottom of page


