再会。我正在尝试编写一个平台游戏。已经实现了创建地图、创建角色、交互和相机移动等基本操作。有4个文件:
游戏.py:
负责创建窗口,并绘制其余部分。也用于在执行任何操作时启用和禁用标志。
import pygame
from pygame import *
import Camera as cam
import Player as plr
import Platform as plfm
WIN_WIDTH = 800
WIN_HEIGHT = 640
HALF_WIDTH = int(WIN_WIDTH / 2)
HALF_HEIGHT = int(WIN_HEIGHT / 2)
DISPLAY = (WIN_WIDTH, WIN_HEIGHT)
DEPTH = 32
FLAGS = 0
CAMERA_SLACK = 30
def main():
global cameraX, cameraY
pygame.init()
screen = pygame.display.set_mode(DISPLAY, FLAGS, DEPTH)
pygame.display.set_caption("JohnTeeworlds")
timer = pygame.time.Clock()
up = down = left = right = running = False
bg = Surface((32,32))
bg.convert()
bg.fill(Color("#000000"))
entities = pygame.sprite.Group()
player = plr.Player(32, 32)
platforms = []
狐的传说
相关分类