移动小人Python程序
代码如下:
import pygame, sys
from pygame.locals import *
FPS = 60
WINDOWWIDTH = 1000
WINDOWHEIGHT = 800
SIZE = (WINDOWWIDTH, WINDOWHEIGHT)
BOUND = (0, 0, WINDOWWIDTH, WINDOWHEIGHT)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
class man(pygame.sprite.Sprite):
movespeed = 5
def __init__(self, bgcolor, initial_pos, bound):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((100, 200))
self.image.fill(bgcolor)
pygame.draw.circle(self.image, BLACK, (50, 30), 30, 2)
pygame.draw.line(self.image