绘制矩形并使用上下左右wasd控制并限制活动区域

This commit is contained in:
zhiyuan committed 2026-07-27 20:15:32 +08:00
1 parent a604dc3b7c
commit 876645f4b0
2 files changed
+7

No files matched your search

Binary file not shown.
+7
View File
@@ -11,6 +11,9 @@ import pygame
# 初始化pygame # 初始化pygame
pygame.init() pygame.init()
# 初始化音乐
pygame.mixer.init()
# 设置窗口大小 # 设置窗口大小
size = (800, 600) size = (800, 600)
screen = pygame.display.set_mode(size) screen = pygame.display.set_mode(size)
@@ -18,6 +21,10 @@ screen = pygame.display.set_mode(size)
# 窗口名称 # 窗口名称
pygame.display.set_caption("New_game") pygame.display.set_caption("New_game")
# 播放并循环音乐
pygame.mixer_music.load(r'D:\python_project\Game_project\file\vespidaze-upbeat-rpg-battle-460971.mp3')
pygame.mixer_music.play(-1)
# 状态值 # 状态值
dirty_x = 400 dirty_x = 400
dirty_y = 300 dirty_y = 300