当前位置:   article > 正文

pygame.Rect_pygame.draw.rect(self.screen,self.color,self.rect)

pygame.draw.rect(self.screen,self.color,self.rect) attributeerror: 'bullet

import sys
import pygame

pygame.init()

draw_x = 100
draw_y = 100
draw_width = 300
draw_height = 300
draw_color = 60, 60, 60
self = pygame.Rect(draw_x, draw_y, draw_width, draw_height)#已屏幕左上角为坐标原点

screen_width = 1000
screen_height = 700
screen_color = (230,230,230)
screen = pygame.display.set_mode((screen_width,screen_height))

while True:

screen.fill(screen_color)
pygame.draw.rect(screen,draw_color,self)
pygame.display.flip()
for event in pygame.event.get():
    if event.type == pygame.QUIT:  # 如果点窗口关闭按钮,检测pygam.QUIT
        sys.exit()  # 游戏退出
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号