forked from barryclark/jekyll-now
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request barryclark#34 from chaelimee/main
버튼 3개 뜨니까, 이젠 눌렀을 때 각각의 파일이 열리도록 만들면 될것같아요!
- Loading branch information
Showing
2 changed files
with
110 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,113 @@ | ||
from G_baseballGame import baseballGame | ||
#from G_avoid import avoidGame | ||
from G_snake import snakeGame | ||
from G_memoryGame import memoryGame | ||
# main_game.py | ||
|
||
import pygame | ||
import sys | ||
from pygame.locals import * | ||
|
||
g = snakeGame() | ||
def G_snake(): | ||
pygame.init() | ||
|
||
while g.running: | ||
g.game_loop() | ||
screen = pygame.display.set_mode((400, 300)) | ||
pygame.display.set_caption("G_snake") | ||
|
||
|
||
font = pygame.font.Font(None, 36) | ||
clock = pygame.time.Clock() | ||
|
||
while True: | ||
screen.fill((255, 255, 255)) | ||
text = font.render("G_snake", True, (0, 0, 0)) | ||
screen.blit(text, (150, 150)) | ||
pygame.display.flip() | ||
|
||
for event in pygame.event.get(): | ||
if event.type == QUIT: | ||
pygame.quit() | ||
sys.exit() | ||
|
||
clock.tick(30) | ||
|
||
def G_avoid(): | ||
pygame.init() | ||
|
||
screen = pygame.display.set_mode((400, 300)) | ||
pygame.display.set_caption("G_avoid") | ||
|
||
font = pygame.font.Font(None, 36) | ||
clock = pygame.time.Clock() | ||
|
||
while True: | ||
screen.fill((255, 255, 255)) | ||
text = font.render("G_avoid", True, (0, 0, 0)) | ||
screen.blit(text, (150, 150)) | ||
pygame.display.flip() | ||
|
||
for event in pygame.event.get(): | ||
if event.type == QUIT: | ||
pygame.quit() | ||
sys.exit() | ||
|
||
clock.tick(30) | ||
|
||
def G_memoryGame(): | ||
pygame.init() | ||
|
||
screen = pygame.display.set_mode((400, 300)) | ||
pygame.display.set_caption("G_memoryGame") | ||
|
||
font = pygame.font.Font(None, 36) | ||
clock = pygame.time.Clock() | ||
|
||
while True: | ||
screen.fill((255, 255, 255)) | ||
text = font.render("G_memoryGame", True, (0, 0, 0)) | ||
screen.blit(text, (150, 150)) | ||
pygame.display.flip() | ||
|
||
for event in pygame.event.get(): | ||
if event.type == QUIT: | ||
pygame.quit() | ||
sys.exit() | ||
|
||
clock.tick(30) | ||
|
||
|
||
|
||
def main(): | ||
pygame.init() | ||
|
||
width, height = 800, 600 | ||
screen = pygame.display.set_mode((width, height)) | ||
pygame.display.set_caption("Main Game") | ||
|
||
font = pygame.font.Font(None, 36) | ||
clock = pygame.time.Clock() | ||
|
||
games = [G_snake, G_avoid, G_memoryGame] | ||
selected_game = 0 | ||
|
||
while True: | ||
screen.fill((255, 255, 255)) | ||
|
||
for i, game in enumerate(games): | ||
text = font.render(f"Game {i + 1}", True, (0, 0, 0)) | ||
screen.blit(text, (width // 2 - 50, 50 + i * 50)) | ||
|
||
pygame.display.flip() | ||
|
||
for event in pygame.event.get(): | ||
if event.type == QUIT: | ||
pygame.quit() | ||
sys.exit() | ||
elif event.type == KEYDOWN: | ||
if event.key == K_UP: | ||
selected_game = (selected_game - 1) % len(games) | ||
elif event.key == K_DOWN: | ||
selected_game = (selected_game + 1) % len(games) | ||
elif event.key == K_RETURN: | ||
# 선택된 게임 실행 | ||
games[selected_game]() | ||
|
||
clock.tick(30) | ||
|
||
if __name__ == "__main__": | ||
main() |
Submodule pygame-SJ
updated
from c39f31 to a75caf