>  2023/03/17 (金) 15:16:04        [misao]
> > チャットジーピーティーで書いてもらったんだけど、これ本当に起動する?
> > 
> > import pygame
> > import random
> > # 初期化
> > pygame.init()
> > # 色の定義
> > BLACK = (0, 0, 0)
> > WHITE = (255, 255, 255)
> > RED = (255, 0, 0)
> > BLUE = (0, 0, 255)
> > YELLOW = (255, 255, 0)
> > # 画面のサイズ
> > size = (600, 600)
> > screen = pygame.display.set_mode(size)
> > pygame.display.set_caption("PacMan")
> > # パックマンの初期位置
> > pacman_x = 300
> > pacman_y = 300
> > # パックマンの大きさ
> > pacman_size = 25
> > # パックマンの速度
> > pacman_speed = 5
> > # 敵の初期位置
> > enemy_x = random.randint(0, 600)
> > enemy_y = random.randint(0, 600)
> > # 敵の大きさ
> > enemy_size = 25
> > # 敵の速度
> > enemy_speed = 5
> > # スコアの初期値
> > score = 0
> > # フォントの設定
> > font = pygame.font.Font(None, 36)
> > # ゲームループ
> > done = False
> > clock = pygame.time.Clock()
> > while not done:
> >     for event in pygame.event.get():
> >         if event.type == pygame.QUIT:
> >             done = True
> >     # パックマンの移動
> >     keys = pygame.key.get_pressed()
> >     if keys[pygame.K_LEFT]:
> >         pacman_x -= pacman_speed
> >     if keys[pygame.K_RIGHT]:
> >         pacman_x += pacman_speed
> >     if keys[pygame.K_UP]:
> >         pacman_y -= pacman_speed
> >     if keys[pygame.K_DOWN]:
> >         pacman_y += pacman_speed
> >     # 敵の移動
> >     if enemy_x < pacman_x:
> >         enemy_x += enemy_speed
> >     if enemy_x > pacman_x:
> >         enemy_x -= enemy_speed
> >     if enemy_y < pacman_y:
> >         enemy_y += enemy_speed
> >     if enemy_y > pacman_y:
> >         enemy_y -= enemy_speed
> >     # 当たり判定
> >     distance = ((pacman_x - enemy_x)**2 + (pacman_y - enemy_y)**2)**0.5
> >     if distance < pacman_size + enemy_size:
> >         score -= 1
> >     # スコアの更新
> >     score += 1
> >     # 画面の描画
> >     screen.fill(BLACK)
> >     pygame.draw.circle(screen, YELLOW, (pacman_x, pacman_y), pacman_size)
> >     pygame.draw.circle(screen, BLUE, (enemy_x, enemy_y), enemy_size)
> >     text = font.render("Score: " + str(score), True, WHITE)
> >     screen.blit(text, [10, 10])
> >     pygame.display.flip()
> >     # フレームレートの制御
> >     clock.tick(60)
> > # 終了処理
> > pygame.quit()
> パワーエサが無い(;´Д`)死んじゃう

動かなかった騙された

参考:2023/03/17(金)15時06分35秒